On 13/05/2011 19:29, Florian Klämpfl wrote:
Am 13.05.2011 17:41, schrieb Martin:

{$MACRO ON}
//{$DEFINE DEBUG_DWARF_PARSER}
{$ifdef DEBUG_DWARF_PARSER}
   {$define DEBUG_WRITELN := WriteLn}
{$else}
   {$define DEBUG_WRITELN := //}
{$endif}


and then
     DEBUG_WRITELN('Skipping directory : ', s);
Or just use an inline function with ifdef as mentioned previously. An
inline function with an empty procedure body shouldn't cause any
additional code.

First of all, i an *no* friend of the example above, nor do I plan to ever do something like it. I don't even plan on using macros at all. But I found it an interesting example how far you can already get with the current macros.

Personally, I IFDEF my debug code. I see it as an advantage. Since the IDE can highlight IFDEFs, I can quickly differentiate them from normal code.

About the inline, and no code generated, if the body is empty.

Dose this apply, even if the procedure takes parameters, and some of the params are function calls ? This is, will fpc skip the function calls, as their result is not used?
I haven't tested it, just curious.

Martin

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to