dmd 1.043 alpha for FreeBSD 7.1
Steven Schveighoffer
schveiguy at yahoo.com
Tue Apr 14 18:25:49 PDT 2009
On Tue, 14 Apr 2009 15:49:02 -0400, Walter Bright
<newshound1 at digitalmars.com> wrote:
> Tomas Lindquist Olsen wrote:
>> And if not, why is there no Linux ? This is the obvious reason for
>> GDC/LDC pick the lowercase identifiers in the first place ...
>
> Because gcc on linux predefines "linux", not "Linux".
Just so you know this argument is flawed. Although you are in your right
to select the identifier, you have based it on invalid logic.
First, nobody can directly compile C code under D, especially with
preprocessor logic. So right there, you already must change the code.
Now, since you must change the code (and most places that are cross
platform don't have simple #ifdef __linux, so global search/replace is no
good), you have plenty of opportunity to change the identifier from
__linux or linux to Linux.
Next, you are inconsistent with other platforms. Windows Defines _WIN32,
yet you use Win32, shouldn't you use WIN32 to be consistent with
capitalization? You are selectively applying reasoning to justify
inconsistent naming techniques.
Just say "Because I'm Walter and I said so" and call it a day, or change
it to the way it should be. Take the identifier name from where you want,
but make the capitalization consistent. We have no legacy requirements
here (read: D compiler does not have to compile C preprocessor code, I
know there's lots of D code with version(linux) already, but now is the
time to make a change, not later), and to make things not follow a
consistent capitalization scheme makes it look like an error in the code.
version(FreeBSD) version=v1;
version(OSX) version=v2;
version(Win32) version=v3;
version(linux) version=v4; // huh? oh, the author must have made a
capitalization error.
If you need another reason, linux looks like 1inux in some fonts ;)
BTW, when I started writing D code for multi-platform, I instinctively
used version(Linux), but found out that was wrong by trial and error.
-Steve
More information about the Digitalmars-d-announce
mailing list