[OT] #define

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon May 22 06:15:31 PDT 2017


On Monday, 22 May 2017 at 13:11:15 UTC, Andrew Edwards wrote:
>     #ifndef THING
>     #define THING
>     #endif

This kind of thing is most commonly used in include guards

https://en.wikipedia.org/wiki/Include_guard#Use_of_.23include_guards

You can usually just strip that out in D, since the module system 
already just works if imported twice.

>     #ifndef SOME_THING
>     #define SOME_THING THING *
>     #endif
>
> Is this equivalent to:
>
>     alias thing = void;
>     alias someThing = thing*;

I'd have to see that in context though to see why they are doing 
it... it is probably some kind of platform specific type 
definitions.


More information about the Digitalmars-d-learn mailing list