View unanswered posts | View active topics



Reply to topic  [ 5 posts ] 
Can I use two constants as a compilation condition? 
Author Message
Member

Joined: Thu May 14, 2015 6:02 pm
Posts: 45
Does FlashDevelop allow for something like this?
Code:
      CONFIG::debug
      CONFIG::air
      private function myFunction():void
      {
         // Do something.
      }

And then the function would only be compiled if both those constants are true?


Wed May 24, 2017 2:45 pm
Profile
Member

Joined: Fri Feb 18, 2011 10:20 pm
Posts: 42
Doesn't it work?

Code:
if (CONFIG::debug == true && CONFIG::air == true) {
    myFunction();
}


Fri May 26, 2017 4:41 am
Profile
Member

Joined: Thu May 14, 2015 6:02 pm
Posts: 45
That's not conditional compilation. The if statement is processed at runtime. It works if what you're trying to do is just not execute the function, but it doesn't work if you don't want to compile the function.


Fri May 26, 2017 3:05 pm
Profile
Member

Joined: Tue Jun 30, 2009 8:06 pm
Posts: 205
Not a FlashDevelop issue - this is an AIR SDK restriction. The following should work (although I have not tested it

Code:
CONFIG::air{
   CONFIG::debug{
      //THIS ONLY HAPPENS ON DEBUG AND AIR
      private function myFunction():void
      {
       // Do something.
      }
   }
}


Mon May 29, 2017 3:10 pm
Profile
Member

Joined: Fri Feb 18, 2011 10:20 pm
Posts: 42
Scythe wrote:
That's not conditional compilation.

Yes. Sorry. My mistake


Sat Jun 10, 2017 8:11 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.