Beta

Slashdot: News for Nerds

×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

Why I don't use GNU/Linux

TheRaven64 (641858) writes | more than 4 years ago

GNU is Not Unix 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.

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.

cancel ×

6 comments

Why not another compiler for the platform? (0)

Anonymous Coward | more than 4 years ago | (#31752230)

Who says you have to use gcc?

Re:Why not another compiler for the platform? (2, Informative)

Baloo Uriza (1582831) | more than 4 years ago | (#31752250)

Also, for some reason, it didn't credit me for the post above... slashcode's starting to show it's age...

Re:Why not another compiler for the platform? (1)

TheRaven64 (641858) | more than 4 years ago | (#31752836)

I'm not using GCC, I'm using clang. GCC doesn't support blocks and so doesn't regard the __block specifier as a keyword. Anyone using GNU/Linux, however, will be using the headers from glibc. This means that you can either use blocks, or you can use glibc, but not both. I'm happy to use blocks and not glibc - I mainly use FreeBSD which Just Works.

Re:Why not another compiler for the platform? (0, Troll)

TheRaven64 (641858) | more than 4 years ago | (#31839088)

+3 informative? Seriously? Who is using mod points in my journal. It's not like one post out of a total of three was in danger of being completely ignored...

underscore (1)

Mr2cents (323101) | more than 4 years ago | (#31862848)

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..

Re:underscore (1)

TheRaven64 (641858) | more than 4 years ago | (#31864950)

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 to employ him, I have no idea.
Check for New Comments
Slashdot Account

Need an Account?

Forgot your password?

Don't worry, we never post anything without your permission.

Submission Text Formatting Tips

We support a small subset of HTML, namely these tags:

  • b
  • i
  • p
  • br
  • a
  • ol
  • ul
  • li
  • dl
  • dt
  • dd
  • em
  • strong
  • tt
  • blockquote
  • div
  • quote
  • ecode

"ecode" can be used for code snippets, for example:

<ecode>    while(1) { do_something(); } </ecode>
Create a Slashdot Account

Loading...