[L2Ork-dev] updating cyclone

Albert Graef aggraef at gmail.com
Fri Mar 17 09:56:16 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

-- 
Dr. Albert Gr"af
Computer Music Research Group, JGU Mainz, Germany
Email:  aggraef at gmail.com
WWW:    https://plus.google.com/+AlbertGraef
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://disis.music.vt.edu/pipermail/l2ork-dev/attachments/20170317/a5653a91/attachment.html>


More information about the L2Ork-dev mailing list