June 22, 2004
Walter wrote:
> "Arcane Jill" <Arcane_member@pathlink.com> wrote in message
> news:cba8os$h17$1@digitaldaemon.com...
> 
>>In article <cb9see$2u9r$2@digitaldaemon.com>, Walter says...
>>
>>>>Just out of curiousity - why is it "linux", not "Linux"?
>>>
>>>Because gcc predefines "linux" for linux-specific code.
>>
>>So what? Is there supposed to be a one-to-one correspondence between D
>>version(...) tags and gcc preprocessor defines then? Because, if there is,
> 
> (a)
> 
>>it's not mentioned anywhere, and (b) I don't think there should be.
>>
>>D is more than just an evolving compiler - it is a *LANGUAGE*. gcc is just
> 
> a
> 
>>program - albeit a compiler, and a damn good one, it is, nonetheless,
> 
> merely one
> 
>>single implementation among many of the C++ (not D) standard. I see no
> 
> reason
> 
>>why this historical accident should force either bad grammar or
> 
> inconsistent
> 
>>style on D.
>>
>>Well - I'm not particularly bothered about this, so I'm not going to argue
> 
> about
> 
>>it beyond this post, but ... why not just be consistent with all the other
> 
> D
> 
>>version names?
>>
>>(And presumably the version name for MacOS should be MacOS ... unless gcc
> 
> gets
> 
>>to define that too).
> 
> 
> I see your point, but there's also a point to abiding by common conventions
> absent a compelling reason for something different. If you've written a lot
> of portable code, you're probably used to using 'linux' rather than 'Linux'
> or 'LINUX' or "__linux__".


I understand your reasoning, but, respectfully, I think you have it backwards.

You argue that it is easier to remember the way to spell something by citing a convention from another compiler and language and regarding a specific OS. This convention is different for other compilers and other OSs (for example, it would be WIN32 or _WIN32 for VC/Windows). So by following these "external" conventions you work against your own goal - it will be impossible to remember the way something is spelt unless you know the external influences.

Just establish a single convention for D and stick with it. That way you only have to remember one thing and it will reliably work for everything you do. Everyone can do that, whether he/she is new to writing portable code or not.

The alternative - having to remember a different spelling for every version statement - is much worse and error-prone.

Hauke


June 23, 2004
"Hauke Duden" <H.NS.Duden@gmx.net> wrote in message news:cbafsu$s5c$1@digitaldaemon.com...
> You argue that it is easier to remember the way to spell something by citing a convention from another compiler and language and regarding a specific OS. This convention is different for other compilers and other OSs (for example, it would be WIN32 or _WIN32 for VC/Windows). So by following these "external" conventions you work against your own goal - it will be impossible to remember the way something is spelt unless you know the external influences.

There's really only one C++ compiler on linux, and that's gcc. Other C++ compilers on linux strive to be bug compatible with it, so they'll be using 'linux' too. Other language compilers are not relevant because D looks to C/C++ for conventions.

There is a compelling reason to not use _WIN32 - Microsoft is coming out with a 64 bit version of Windows, yet they'll still be leaving _WIN32 defined, but optionally define _WIN64. No thanks.

> Just establish a single convention for D and stick with it. That way you only have to remember one thing and it will reliably work for everything you do. Everyone can do that, whether he/she is new to writing portable code or not.
>
> The alternative - having to remember a different spelling for every version statement - is much worse and error-prone.

It would be fine if there were such a thing as a standard spelling and caps convention for an operating system. But there isn't. Especially when OS vendors follow the wretched practice of putting punctuation marks in the names of their products, like MS-DOS and OS/2. I see Mac OS X with several different spellings - this is from apple's own web site:

Mac OS X
macosx
X
Mac OS X Panther
Panther
Mac OS

However, OS vendors tend to endorse a specific C/C++ compiler, and that compiler in it will have a specific #define for the OS. So following that convention makes sense. If the Linux people didn't like 'linux', why did they put it in GCC?


June 23, 2004
Walter wrote:
> However, OS vendors tend to endorse a specific C/C++ compiler, and that
> compiler in it will have a specific #define for the OS. So following that
> convention makes sense. If the Linux people didn't like 'linux', why did
> they put it in GCC?

It's more a question of consistency.

linux
__FreeBSD__
SOLARIS
__hpux
MACOSX

/Oskar
1 2
Next ›   Last »