Why is Linux the only OS in version identifier list that has a lowercase name?
Ali Çehreli via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Apr 10 18:15:27 PDT 2016
On 04/10/2016 03:03 PM, Zekereth wrote:
> So I was just testing some code and couldn't figure out why it wasn't
> working. My version block looked like this:
>
> version(Linux)
> {
> ...
> }
>
> Looking at the list(unless I'm missing something) Linux is the only OS
> that is lowercase. I'm guessing most people use Posix instead and never
> encounter this problem.
>
> Regard,
> Zekereth
As a workaround, you can set version to Linux yourself:
version (linux) {
version = Linux;
}
void main() {
version (Linux) {
import std.stdio;
writeln("Linux worked!");
}
}
More information about the Digitalmars-d-learn
mailing list