Re: Conditional code

From: Andrey Tarasevich (andreytarasevich_at_hotmail.com)
Date: 02/02/05


Date: Wed, 02 Feb 2005 13:29:17 -0800

Dave Moore wrote:
>
> ROFL .. I was wondering what on earth you were talking about until I looked
> closely at my earlier suggestion .. what I meant was:
>
> #else
> #define dbgprintf //
>
> that way whatever the args of dbgprintf are, they will be turned into a
> comment. I knew I had used comments previously to deal with this, but I
> didn't remember exactly how. Sorry for the confusion.
> ...

This might work with some compilers, but won't work in general. In C++
the comments are fully processed (and replaced with whitespace) before
the preprocessor has a chance to do its thing. The compiler is free to
assume that preprocessor doesn't generate any new comments.

-- 
Best regards,
Andrey Tarasevich


Relevant Pages

  • Re: Reusable source code
    ... why optimizations in optimizing compilers make notable alterations to the ... One needn't be a qsort() internals man to understand it spends ... preprocessor (actually, most notably, with MSVC's preprocessor, and my ...
    (comp.lang.c)
  • Re: Comparision of C Sharp and C performance
    ... you can learn a lot more sometimes from understanding ...     double dif; ... you assume that all C compilers will do the constant division ... you don't evaluate an invariant in a for loop IF the preprocessor ...
    (comp.lang.c)
  • Re: Comparision of C Sharp and C performance
    ...     double dif; ... compile time with runtime operations. ... you assume that all C compilers will do the constant division ... you don't evaluate an invariant in a for loop IF the preprocessor ...
    (comp.lang.c)
  • Re: ORDER BY a second letter of a field
    ... playing with different compilers and compiler options by creating a ... differences between VB code and the code the VB preprocessor ... justifiable reason to go there other than simple curiosity. ... few I found were of limited value and produced mostly a maintenance ...
    (microsoft.public.vb.general.discussion)
  • Re: The "F" language.
    ... "implicit none" almost as soon as I began using Fortran, ... when C compilers were memory limited and so didn't diagnose as ... write a preprocessor that will convert the existing code. ...
    (comp.lang.fortran)