[OT] #define
Andrew Edwards via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon May 22 09:37:51 PDT 2017
On Monday, 22 May 2017 at 13:15:31 UTC, Adam D. Ruppe wrote:
> 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
Have a basic understanding. In the specific case i'm looking at,
they are not used as include guards though.
> You can usually just strip that out in D, since the module
> system already just works if imported twice.
Makes sense.
>> #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.
Specific context at the following links:
https://github.com/glfw/glfw/blob/66ff4aae89572419bb130c5613798e34d7521fc7/deps/glad/glad.h#L24-L48
https://github.com/glfw/glfw/blob/66ff4aae89572419bb130c5613798e34d7521fc7/deps/glad/glad.h#L57-L81
https://github.com/glfw/glfw/blob/66ff4aae89572419bb130c5613798e34d7521fc7/deps/glad/glad.h#L88-L124
Thanks,
Andrew
More information about the Digitalmars-d-learn
mailing list