On Sunday 27 February 2011 07:18:29 David Nadlinger wrote: > On 2/27/11 3:52 PM, simendsjo wrote: > > I'm having some problems grokking version. > > > > How would I translate this simple C macro? > > #if !defined(IDENT) || !defined(IDENT2) > > You are facing a quite common question, with the answer being that there > is no simpler way to do this, at least that I know of. > > This has to do with both the stage at which version blocks are parsed > internally, and with Walter taking a defensive stance on the power of > version statements because he feels that the typical C preprocessor > constructs are often a source for confusion (sorry if I misquoted you > there).
Yeah. Essentially, Walter believes that how versioning is often done in C with #ifdefs is inherently wrong. If you're doing complicated versioning statements like that you really need to rethink how you're doing things. You shouldn't need them. Granted, converting from C/C++ can be quite a bit messier in that regard than writing D code from scratch, but still, in general, if you need complicated versioning statements, then you're probably going about it the wrong way. Though, on occasion, it definitely _would_ be nice to have the ability to || version identifiers together, and I'm not sure what the problem with that would be other than the fact that version statements just don't work that way and their implementation would probably have to be redesigned a fair bit to allow for it. Walter is _definitely_ against the negation of version identifiers and stuff like that though. - Jonathan M Davis