digitalmars.D - Predefined Version Identifier on Linux
- Shan-yung Yang (2/2) Mar 28 2007 Hi,
- Walter Bright (2/3) Mar 28 2007 It's consistent with the macro "linux" predefined by gcc on linux.
- Shan-yung Yang (2/7) Mar 28 2007 But on windows almost all compilers use "WIN32" or "_WIN32" with all let...
- Walter Bright (2/10) Mar 28 2007 The corresponding one would be "_WINDOWS". But that just looks so awful ...
- Dan (3/4) Mar 28 2007 Thanks Walter, for not using that. Personally, I think Walter did the m...
- Shan-yung Yang (3/8) Mar 29 2007 Indeed. I'm often confused by those unpredictable underscores and capita...
- Carlos Smith (11/11) Mar 28 2007 : It's consistent with the macro "linux" predefined by gcc
- Daniel Keep (36/53) Mar 28 2007 Probably because everything else in the language is case-sensitive;
- =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= (13/23) Mar 28 2007 Fortunately the other platforms are all lowercase:
- =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= (2/12) Mar 28 2007 Ehrm, "mingw32" would be Windows (or Win32?) but anyway.
- Carlos Smith (9/9) Mar 28 2007 : Sorry. I haven't had the opportunity to annoy anyone
- Dan (6/12) Mar 28 2007 Wow dude.
Hi, I wonder why the first letter of predefined identifier "linux" is not uppercased. This looks inconsistent with other uppercased identifiers and makes users confused.
Mar 28 2007
Shan-yung Yang wrote:I wonder why the first letter of predefined identifier "linux" is not uppercased. This looks inconsistent with other uppercased identifiers and makes users confused.It's consistent with the macro "linux" predefined by gcc on linux.
Mar 28 2007
Walter Bright Wrote:Shan-yung Yang wrote:But on windows almost all compilers use "WIN32" or "_WIN32" with all letters uppercased. Should D also use "WIN32" by this reason?I wonder why the first letter of predefined identifier "linux" is not uppercased. This looks inconsistent with other uppercased identifiers and makes users confused.It's consistent with the macro "linux" predefined by gcc on linux.
Mar 28 2007
Shan-yung Yang wrote:Walter Bright Wrote:The corresponding one would be "_WINDOWS". But that just looks so awful :-(.Shan-yung Yang wrote:But on windows almost all compilers use "WIN32" or "_WIN32" with all letters uppercased. Should D also use "WIN32" by this reason?I wonder why the first letter of predefined identifier "linux" is not uppercased. This looks inconsistent with other uppercased identifiers and makes users confused.It's consistent with the macro "linux" predefined by gcc on linux.
Mar 28 2007
Walter Bright Wrote:The corresponding one would be "_WINDOWS". But that just looks so awful :-(.Thanks Walter, for not using that. Personally, I think Walter did the mostly right thing; but I understand most of us prefer Linux over windows and don't like feeling less capitalized. Don't worry. With Virtual Iron 3.5 out, Windows is practically a goner. Highly recommended.
Mar 28 2007
Walter Bright Wrote:Shan-yung Yang wrote:Indeed. I'm often confused by those unpredictable underscores and capitals when writing C code. Personally I agree with Carlos' opinion that version identifiers should be case insensitive, or there should be one single convention: either camel cased or adopting the corresponding macro in C. I'll appreciate camel case since the latter is often a mess.But on windows almost all compilers use "WIN32" or "_WIN32" with all letters uppercased. Should D also use "WIN32" by this reason?The corresponding one would be "_WINDOWS". But that just looks so awful :-(.
Mar 29 2007
: It's consistent with the macro "linux" predefined by gcc on linux. Version identification should be case insensitive. What is the point to make a difference between Linux linux or Win32 WIN32 win32 Did anybody asked for this before ?
Mar 28 2007
Carlos Smith wrote:: It's consistent with the macro "linux" predefined by gcc on linux. Version identification should be case insensitive. What is the point to make a difference between Linux linux or Win32 WIN32 win32 Did anybody asked for this before ?Probably because everything else in the language is case-sensitive; having a single, non-obvious break would be a bit silly. Plus, we would *then* have people coming and asking "why are version identifiers case-insensitive: they should be case-sensitive". <joke> Now, the *real* solution to this problem is to rename all the identifiers to use l33t speak and alternating caps. This way, everyone is annoyed equally, and no one group has an advantage over the others. Sure everybody loses, but at least we all lose *equally*. </joke> <joke type="alternate" id="1"> Just look at it this way: you Linux people are better off since you don't need to use the shift key to type your platform identifier! Less key presses == more productive! </joke> <joke type="alternate" id="2"> The real reason Walter did this is because he's trying to discourage people from writing non-portable code. He probably figures that it he makes every single platform identifier different in some subtle, non-predictable manner, people will get sick of it and just write portable code in the first place. Coming soon: version( MACos_X )! </joke> Sorry. I haven't had the opportunity to annoy anyone today, and I just watched House. Baaaad combination... ;) -- Daniel -- int getRandomNumber() { return 4; // chosen by fair dice roll. // guaranteed to be random. } http://xkcd.com/ v2sw5+8Yhw5ln4+5pr6OFPma8u6+7Lw4Tm6+7l6+7D i28a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP http://hackerkey.com/
Mar 28 2007
Daniel Keep wrote:The real reason Walter did this is because he's trying to discourage people from writing non-portable code. He probably figures that it he makes every single platform identifier different in some subtle, non-predictable manner, people will get sick of it and just write portable code in the first place.Fortunately the other platforms are all lowercase: - linux - freebsd - cygwin - mingw32 - darwin - solaris - skyos And you can use version( Unix ) for all of those...Coming soon: version( MACos_X )! </joke> Sorry. I haven't had the opportunity to annoy anyone today, and I just watched House. Baaaad combination... ;)There already is a version (MacOSX) in use in dAllegro. HHOS. --anders
Mar 28 2007
Fortunately the other platforms are all lowercase: - linux - freebsd - cygwin - mingw32 - darwin - solaris - skyos And you can use version( Unix ) for all of those...Ehrm, "mingw32" would be Windows (or Win32?) but anyway. --anders
Mar 28 2007
: Sorry. I haven't had the opportunity to annoy anyone today, and I just : watched House. Baaaad combination... ;) LoL ! GrEaT, dO yOu FeEl BeTtEr NoW ? iF yEs, ThAn I WiLl CoNsIdEr ThIs aS mY lItTle CoNtRiBuTiOn To BrInG jOy In ThE lIfE oF sOmEoNe ! HaVe A nIcE dAy.
Mar 28 2007
Carlos Smith Wrote:GrEaT, dO yOu FeEl BeTtEr NoW ? iF yEs, ThAn I WiLl CoNsIdEr ThIs aS mY lItTle CoNtRiBuTiOn To BrInG jOy In ThE lIfE oF sOmEoNe ! HaVe A nIcE dAy.Wow dude. I didn't know you were the maintainer of *that many* Linux modules. They mostly follow convention, but it always irked me reading the source, 'cause the case rules change every other identifier. x = HOLY_HELL_IM_CAPITALIZED; x += WhatDoYouThink * iDontKnow(im_just_trying_to_read,thissource);
Mar 28 2007