[L2Ork-dev] updating cyclone

Derek Kwan derek.x.kwan at gmail.com
Fri Mar 17 12:40:48 UTC 2017


> On Fri, Mar 17, 2017 at 10:11 AM, Derek Kwan <derek.x.kwan at gmail.com> wrote:
> 
> > so we only want to
> > build including the ifdeffed code for use with pd-vanilla.
> >
> 
> Yes, that's all good and fine, but you're doing it wrong. As I said, you
> must use:
> 
> #ifndef PDL2ORK
> ...
> #endif
> 
> or:
> 
> #if !defined(PDL2ORK)
> ...
> #endif
> 
> for sections of code that should be excluded when compiling for Pd-l2ork.
> This:
> 
> #if !PDL2ORK
> ...
> #endif
> 
> does *not* work, because PDL2ORK is *just* a defined symbol (i.e., it's
> defined, but has an empty value), so the above expands to:
> 
> #if !
> ...
> #endif
> 
> which obviously won't work. (Oddly enough, the above *will* work if the
> PDL2ORK symbol isn't defined at all, since apparently most C preprocessors
> will take undefined symbols to denote a zero value in preprocessor
> expressions. Not sure what the ANSI standard says about this, I'm too lazy
> to look it up right now.)
> 
> If that doesn't make any sense to you, you need to read up on how #define
> and #ifdef / #ifndef work. This isn't really explained very well in the GNU
> cpp manual, since it's "folklore" which every C programmer is supposed to
> know already. ;-) It's surely explained in the K&R ANSI C book (which is
> recommended reading for any aspiring C programmer). Anyway, just use
> #ifndef for the test, then everything will be all right.
> 
> HTH,
> Albert
> 

Ah, sorry. Well, I'm generally aware of how ifdefs work, although definitely
that undefined symbol behavior threw me for a loop. Thanks for the discussion
=).  I've just been mainly confused as to what the original goal was,
but I think I get it now and will add in the changes as per your latest
e-mail.

Thanks =)

Derek

-- 
Derek Kwan
www.derekxkwan.com


More information about the L2Ork-dev mailing list