Catch up on stories from the past week (and beyond) at the Slashdot story archive

 



Forgot your password?
typodupeerror
×
GNU is Not Unix

Journal TheRaven64's Journal: Why I don't use GNU/Linux 6

There are two reasons why I don't use GNU/Linux: One is GNU, the other is Linux. Of these, the larger reason is GNU, and specifically the glibc part. The most recent reinforcement of this is Ulrich Drepper's inability to read the C specification.

For those not familiar with the C specification, all identifiers that start with an underscore are reserved for the implementation (see section 17.4.3.1.2). You should never use them in your own code, because your compiler is completely free to do whatever it wants with them. By convention, single underscores are used for global non-standard libc extensions and double underscores are used for compiler builtins.

You can find a number of these in existing compiler. Microsoft exposes SEH with keywords like __try. GCC provides __asm for inline assembly, ICC uses __cpuid for accessing the CPUID instruction, and so on. Clang added __block as a type specifier for their variables that are copied to the heap for use by blocks (closures).

Unfortunately, it turns out that the glibc headers use __block as a parameter name. There are several things wrong with this. One is that they use double underscores at all. By convention, these are reserved for the compiler, while single underscores are reserved for the libc. The second is that they used underscores at all in a parameter. Parameter names are not in the global scope, so they can be anything to prevent name clashes.

The result of this is that, if you use glibc, you can't also use blocks. This is a shame, because we (Etoile) were shipping a working blocks implementation six months before Apple. Well, working on *BSD and Solaris (and probably Windows, QNX and Symbian with PIPS, but not tested there). This problem means that it doesn't work on GNU/Linux.

No problem for me. I only use platforms with libc implementations written by people who can read specs. It may be a problem for some of you, if you use a broken platform with a libc maintained by someone who'd rather salvage his ego than fix a problem, and if it is then I'm sorry for you. My suggestion is that you remember that there are other options.

This discussion has been archived. No new comments can be posted.

Why I don't use GNU/Linux

Comments Filter:
  • Hmm.. I have been aware of the underscore name reservation, but I always thought it was only for double underscores or single underscores followed by a capital letter. Something similar is mentioned in the bug report, although IBM doesn't seem to agree. If all single underscores are reserved, I'd better start cleaning up my code because I use it for static variables. That's also a common convention, unless I'm mistaken..

    • The standard reserves all identifiers that start with an underscore. GCC does not reserve identifiers that start with a single underscore followed by a lowercase letter. The reason for this is that the 'implementation' includes both the libc and the compiler; GCC reserves those for GLIBC to use. The fact that GLIBC is using some that GCC reserve is a bug in GLIBC, but Drepper refuses to acknowledge it because his code is always right and any counter evidence is always wrong. Quite why Red Hat continues

What is research but a blind date with knowledge? -- Will Harvey

Working...