compiler-directives

Delphi #IF(DEBUG) equivalent?

Is there a Delphi equivalent of the C# #if(DEBUG) compiler directive? ...

#warning directive in VB.net

I know the #warning directive does not exist in vb.net... is there anything like it? I want to be able to throw messages (warnings) at compiler time. ...

Conditional compile when running in Simulator as opposed to on a device

Is there a compiler directive I can use to compile a different line of code when targetting the simulator as opposed to my device. Something like: # IF SIMULATOR [self.imagePicker setSourceType:UIImagePickerControllerSourceTypePhotoLibrary]; # ELSE [self.imagePicker setSourceType:UIImagePickerControllerSourceTypeCamera]; # END EDIT D...

What all APIs are affected by {$IOCHECKS OFF}?

We have some ancient Delphi code (might have even originated as Turbo Pascal code) that uses {$I-}, aka {$IOCHECKS OFF}, which makes the code use IOResult instead of exceptions for disk I/O errors. I want to get rid of the {$I-} and bring this code forward into the 1990s, but to do that, I'd like to know what all is affected by {$IOCHE...

@property and @synthesize: why both?

I have been climbing the learning curve of X-code for about two months now. I understand the purpose of the @property/@synthesize directives, but it seems that it is a bit redundant to always declare the properties in the .h file, and then synthesize them in the .m file. Why does the compiler need both directives? If they are always ...

How to set project wide #define in C#

I have several classes in a project which need to only be in certain builds of the application which are currently not ready for release or debug. To prevent these classes from being used, I want to set around them this: #if USE_MYCLASS // Code here... #endif Unfortunately, I don't know how to setup a project wide #define. Is there ...

Removing Delphi IFDEf compiler directives automatically

I am currently working with 'inherited' code that has (scattered randomly throughout) a whole bunch of conditional compiler directives based on the version of Delphi, going back to Delphi 2 . From now on, all development will be with Delphi 2009 or future. Is there a tool in Delphi 2009 , or a plugin, that will automatically remove comp...

Implicit casting Integer calculation to float in C++

Is there any compiler that has a directive or a parameter to cast integer calculation to float implicitly. For example: float f = (1/3)*5; cout << f; the "f" is "0", because calculation's constants(1, 3, 10) are integer. I want to convert integer calculation with a compiler directive or parameter. I mean, I won't use explicit casting ...

C# Compiler Directives

I’m looking at some C# code, and have come across the following statement: #if DEBUG // Do something here #else // Do something else #endif I assumed that DEBUG would be a defined somewhere as follows: #define DEBUG But I’m unable to find such a definition, although the code seems to behave as though it were set. Is DEBUG ...

#Define Compiler Directive in C#

In C, I could declare a compiler directive as follows: #define MY_NUMBER 10 However, in C#, I only appear to be able to do this: #define MY_NUMBER Which is obviously useless in this case. Is this correct, or am I doing something wrong? If not, can anyone suggest a way of doing this, either at namespace or solution level? I tho...

Delphi Compiler Directive to Evaluate Arguments in Reverse

I was really impressed with this delphi two liner using the IFThen function from Math.pas. However, it evaluates the DB.ReturnFieldI first, which is unfortunate because I need to call DB.first to get the first record. DB.RunQuery('select awesomedata1 from awesometable where awesometableid = "great"'); result := IfThen(DB.First = 0, DB...

using VB.Net And/Or operators for logical short-circuiting: Any compiler-directive/workaround?

I found using AndAlso/OrElse, all the time, VERY annoying. It reduces code readability, especially when conditioning get complicated. Any suggestions? ...