version and debug statements

pragma pragma_member at pathlink.com
Thu May 11 19:17:36 PDT 2006


In article <e40ehq$2pgs$1 at digitaldaemon.com>, Walter Bright says...
>
>pragma wrote:
>
>> Walter, I mean no disrespect here, but I simply must ask: Are you talking about
>> a literal interpretation of version() and debug(), including the lack of an
>> #ifndef equivalent?  
>> 
>> Like this:
>> 
>> #ifdef FOOBAR
>> #else
>> /*** code ***/
>> #endif
>> 
>> Or like this (using ifndef):
>> 
>> #ifndef FOOBAR
>> /*** code ***/
>> #endif
>> 
>> I don't think that version() and debug() need to be tangled up with all kinds of
>> boolean expressions, but maybe a short-and-sweet concession to allow an
>> equivalent to #ifndef is in order?  Sure its just "one line more readable" but
>> it *is* more readable after all. 
>
>Consider another perspective: when a version of the code is being built, 
>one thinks about a version being build, not a "not version". If you find 
>that you're writing:
>
>version (FOOBAR)
>else
>{
>	...
>}
>
>I suggest that perhaps FOOBAR is the wrong name for the version being 
>compiled. For example, I would red flag code that looked like:
>
>version (Windows)
>else
>{
>	...
>}
>
>I also have a particular dislike for the execrable double negative style 
>often seen in C:
>
>#ifndef NO_FOO
>...
>#endif
>
>There is some psychobabble research on this, suggesting that people tend 
>to skip nots, and even more often miss double negatives. I know that in 
>airplane pilot jargon, considerable effort has been made to purge 
>negations and replace them with positive statements, as they are less 
>prone to misinterpretation.
>
>Some more examples:
>
>1) Don't build a "NOTFULL" version, build a "DEMO" version.
>2) Don't build a "NOTDEMO" version, build a "FULL" version.
>3) Don't build a "NOHARDTABS" version, build a "SOFTTABS" version.
>
>etc. If there are some specifics cases you feel just don't fit with 
>this, can you post them?

Actually I don't have anything to cite that would be contrary to this -
especially after your explaination, thank you. :)

I never thought to look at versioning that way, and I'm glad that you took the
time to explain it all out. Perhaps we've all been flipping bits back and forth
too much to realize that "false" and "!true", while semantically the same thing,
may lead to different uses and interpretations (and mis-interpretations).  

You've given me much to think about.

- EricAnderton at yahoo



More information about the Digitalmars-d mailing list