Slashdot Mirror


ISO Updates C Standard

An anonymous reader writes "The International Organization for Standardization (ISO) has published the new specifications for the C programming language. The standard is known unofficially as C1X and was published officially as ISO/IEC 9899:2011. It provides greater compatibility with the C++ language and adds new features to C (as indicated in the draft)."

68 of 378 comments (clear)

  1. First post!! by Anonymous Coward · · Score: 5, Insightful

    Actually, who cares about that?

    Seriously, though, am I the only one who finds it strange that one has to buy copies of the standard?

    1. Re:First post!! by symbolset · · Score: 5, Insightful

      Actually though, most of us. Changes to the C standard are a big deal.

      --
      Help stamp out iliturcy.
    2. Re:First post!! by Anonymous Coward · · Score: 3, Funny

      Do they sell them by the C-shore?

    3. Re:First post!! by Anonymous Coward · · Score: 5, Informative

      Oh? $300? For a PDF file? Heh.

    4. Re:First post!! by JustOK · · Score: 5, Funny

      yes, if you have 300 clams.

      --
      rewriting history since 2109
    5. Re:First post!! by dutchd00d · · Score: 4, Insightful

      Not really, a lot of books cost money. Why would this one be different?

      First of all, it's not a book. It's a PDF. Second of all, the Netherlands is a member body of ISO, so I have already paid for it through my taxes. I should be able to use the fruits of ISO without additional cost (or maybe some nominal fee). Third of all, an ISO standard has the status of a law: you'd better do it this way, or else. So they're telling me the law has changed, and then charging me 300 euros to find out precisely what the new law is. I believe that's called extortion.

    6. Re:First post!! by Noughmad · · Score: 5, Funny

      The new standard have been on display for free at the Alpha Centauri planning office for the last fifty years.

      --
      PlusFive Slashdot reader for Android. Can post comments.
    7. Re:First post!! by guus_deleeuw · · Score: 2

      Exactly, it's not a reasonable $5 per copy (which I think will make them a lot more money than selling it for $300).

    8. Re:First post!! by 93+Escort+Wagon · · Score: 4, Funny

      Oh? $300? For a PDF file? Heh.

      But these limited-edition PDFs are signed and numbered.

      --
      #DeleteChrome
    9. Re:First post!! by TheRaven64 · · Score: 5, Informative

      The last draft and the errata are always free downloads. That's what I've been using to implement the atomics stuff in clang / FreeBSD.

      --
      I am TheRaven on Soylent News
    10. Re:First post!! by wzzzzrd · · Score: 4, Informative

      It's 300 bucks, it was produced by a committee financed by tax payer's money, it's a pdf, not even a printed book. It's an open standard and will be needed by a lot of developers who want or must write standard compliant code. This is EXACTLY the thing RMS means when he is shouting his song.

      Grab the original file from here.

      --
      On second thought, let's not go to Camelot. It is a silly place.
    11. Re:First post!! by thegarbz · · Score: 2

      You laugh. But the PDFs we get at work through a subscription to a site that provides various standards are "limited to view for 48 hours". Unfortunately the limited to view bit is simply a javascript code that checks to see if the file was downloaded more than 4 days ago (date imprinted on each PDF when you download) and then covers the screen with a big denied message blocking the text.

      DRM at its finest. Pity I have Javascript disabled in Acrobat. Also you can simply print the PDF to CutePDF to strip out the Javascript, or strip it out with any PDF editor that allows scripting.

    12. Re:First post!! by NekSnappa · · Score: 3, Funny

      I think you meant c-shells.

      --
      I want to shoot the messenger!
    13. Re:First post!! by bunratty · · Score: 4, Insightful

      You're not paying for just the production or distribution of the file, book, movie, music, software, or drug when you pay for those things. You're paying for the effort required to make the item in the first place. If it takes someone one year to write a book, they need to recieve much more than the cost of distributing a PDF file to make a living from writing.

      --
      What a fool believes, he sees, no wise man has the power to reason away.
    14. Re:First post!! by Vanders · · Score: 3, Funny

      Developers can't write standards compliant code without knowing what the standards are.

      Oh what am I saying? Developers won't write standards compliant code even if they do know what the standards are!

    15. Re:First post!! by surmak · · Score: 2

      I cannot say for the C standard, but in my work, we do some standards development under ISO. None of this work is funded by ISO -- it is either funded by my employer, or government agencies, commercial end-users, or others that have in interest in the technology getting standardized. This process can be quite expensive -- salaries, travel, meetings, but none of that is paid by ISO. It is all paid by the participants (or funding they can acquire from other interested parties.).

      ISO basically acts as a middleman. They collect their fee on the work done by others, and do not provide any value add other than blessing the standard as an International Standard.

    16. Re:First post!! by Noughmad · · Score: 2

      I'm not realy sure, but here are my best three guesses:

      1. I am a funny guy (in general)
      2. There is a grammatical mistake I didn't catch before clicking Submit
      3. It references The Hitchhiker's Guide to the Galaxy

      --
      PlusFive Slashdot reader for Android. Can post comments.
    17. Re:First post!! by bonch · · Score: 4, Informative

      This is EXACTLY the thing RMS means when he is shouting his song.

      Of course, when he's not doing that, he's advocating necrophilia and "voluntary pedophilia". Maybe not the best spokesperson to get behind.

    18. Re:First post!! by Myopic · · Score: 2

      Here's the quote you refer to:

      For necrophilia, it might be necessary to ask the next of kin for permission if the decedent's will did not authorize it. Necrophilia would be my second choice for what should be done with my corpse, the first being scientific or medical use. Once my dead body is no longer of any use to me, it may as well be of some use to someone. Besides, I often enjoy rhinophytonecrophilia (nasal sex with dead plants).

      That sounds like a jest to me.

    19. Re:First post!! by bonch · · Score: 2

      He also wrote in 2003:

      "[P]rostitution, adultery, necrophilia, bestiality, possession of child pornography, and even incest and pedophilia” [...] All of these acts should be legal as long as no one is coerced. They are illegal only because of prejudice and narrow-mindedness."

      I repeat--he is advocating necrophilia and even possession of child pornography.

    20. Re:First post!! by GameboyRMH · · Score: 2
      --
      "When information is power, privacy is freedom" - Jah-Wren Ryel
  2. Re:At least... by the_B0fh · · Score: 2

    Why would Dennis Ritchie have anything against it?

  3. Let's get C99 right first by JDG1980 · · Score: 2, Informative

    Currently, Microsoft Visual Studio does not even support the C99 standard. Unfortunately, it's unlikely that this standard will be widely adopted any time soon when Microsoft seems to be content to let standard C wither and die.

    1. Re:Let's get C99 right first by wdef · · Score: 4, Informative

      C is withering and dying? Isn't it still used more than any other language: http://langpop.com/

    2. Re:Let's get C99 right first by Daniel+Phillips · · Score: 5, Interesting

      Who cares about Microsoft these days? Any damage they cause by lagging behind standards is only to themselves, unlike the bad old days. In the modern world GCC is the bar by which Microsoft is measured, and usually found lacking.

      --
      Have you got your LWN subscription yet?
    3. Re:Let's get C99 right first by nzac · · Score: 2

      How is C in anyway dependent on Microsoft VS support? VS as far as I can tell is for writing User level applications on managed code where C is terrible. Even GTK have realized that objects are good for writing most Applications.

      The reason c is still around is to write the low level stuff that you can't swap out in windows. If MS could set the programming languages, C would not have been taught for at least 10 years and everything would be full of the lag and bloat that comes with non native code.

    4. Re:Let's get C99 right first by Feltope · · Score: 4, Insightful

      COBOL is king, always will be.

      Solid and reliable code that works period!

      --
      thanks, Feltope
    5. Re:Let's get C99 right first by peppepz · · Score: 2
      Microsoft has been steering their developers away from C and C++ for a long time now. Using Visual Studio for pure native projects is a pain. The pre-release Visual Studio contained in the Windows 8 technical preview won't even allow you to write non-Metro applications (or at least they made it so hard that I couldn't find how to do it).

      Fortunately, there are alternatives to Visual Studio even on Windows.

    6. Re:Let's get C99 right first by hairyfeet · · Score: 3, Insightful

      Don't forget to use the magic uncripple settings if you do that Mr AC or you'll be tying a boat anchor to every non Intel chip that tries to run you code.

      --
      ACs don't waste your time replying, your posts are never seen by me.
    7. Re:Let's get C99 right first by JDG1980 · · Score: 4, Insightful

      Microsoft wants C to die. No one else is cooperating with them on this. As a result, Windows developers are stuck with worse tools for C than developers on almost any other platform. (Yes, there's MinGW, but it's a real pain and does not support many newer Windows APIs at all.)

    8. Re:Let's get C99 right first by JDG1980 · · Score: 3, Informative

      Unfortunately, the damage goes beyond that. You can't effectively use GCC (MinGW) to build most Windows applications, not only because these applications are full of Visual C++isms, but also because many newer APIs (notably Direct2D and DirectWrite) are not currently supported under MinGW at all.

    9. Re:Let's get C99 right first by tapspace · · Score: 2

      What OS kernel is written in Cobol again? I seem to have forgotten. Real mission critical stuff at Boeing? NASA? All that stuff then right?

    10. Re:Let's get C99 right first by Anonymous Coward · · Score: 4, Informative

      "This includes even the most basic stuff, like declaring variables in the middle of your code. It's actually a GCC extension to C"

      No it's not— it's part of ISO C99.

    11. Re:Let's get C99 right first by kthreadd · · Score: 3, Insightful

      If your program relies on the presence of GCC extensions, you did it wrong in the first place.

    12. Re:Let's get C99 right first by Freestyling · · Score: 4, Interesting

      Hi, I'm a Windows developer.

      I'll take C# over C any day, and I have 20 years of C experience.

      I believe that's kinda the parent poster's point. For a windows developer MS make their proprietary C# language easy, and C hard work. Now for most stuff that's fine, but sometimes a lower level language is needed. Ever tried writing a kernel mode driver in C#?

    13. Re:Let's get C99 right first by Anonymous Coward · · Score: 3, Informative

      For a windows developer MS make their proprietary C# language easy, and C hard work. Now for most stuff that's fine, but sometimes a lower level language is needed.

      Interesting, it's like you've never heard of C++ which MS does fully support [slowly] and is standard. I know pure C is a sacred cow but writing pure procedural code in C++ won't kill you, in fact, it will probably make the code much easier to read since you can't just arbitrarily cast back and forth between void pointers and other types without explicit type brackets.

      Ever tried writing a kernel mode driver in C#?

      MS has been experimenting with that but it seems more likely that they'll just hoist most drivers into user space services so you can use any language, .Net based or not. They've already hoisted some USB drivers and the bulk of WDDM video card drivers, just backwards compatibility in the way for the rest.

    14. Re:Let's get C99 right first by rev0lt · · Score: 4, Interesting

      The solidity and reliability of COBOL code comes from decades of correcting bugs and lack of features of most applications that are still in use today. And yes, I've worked professionally as a COBOL programmer.

    15. Re:Let's get C99 right first by Richard_at_work · · Score: 4, Interesting

      Not being a C or C++ developer, I'm not sure who to believe - in the Firefox compilation story a few days ago, there were a fair few highly modded up posts extoling the virtues of the quality and speed of binaries output by the MS C and C++ compiler over GCC.

      Any thoughts on that?

    16. Re:Let's get C99 right first by rev0lt · · Score: 4, Informative

      Actually, C# is as proprietary as C - it isn't. Check http://msdn.microsoft.com/en-us/netframework/aa569283 for the ISO standard details regarding C#.
      Microsoft .NET implementation is proprietary, but there is an early open source release of the .NET CLI implementation codenamed "Rotor", for XP, FreeBSD and MacOS X. Additionally, the Mono project is an opensource clean-room implementation, but it may not be feature-complete.

      Microsoft Research has an interesting project called Singularity - an operating system running (mostly) in managed code. Some initialization routines are done in Assembly/C/C++, but the kernel itself and respective drivers are written entirely in managed code. Check http://en.wikipedia.org/wiki/Singularity_(operating_system).

    17. Re:Let's get C99 right first by TheRaven64 · · Score: 3, Informative

      GCC? People still use that? Clang can now parse a lot of the standard windows headers. 3.1 should have finished implementing the required quirks to understand the Windows templates. There's also work underway to support the Win64 exception model, which will hopefully be done by the 3.1 release.

      --
      I am TheRaven on Soylent News
    18. Re:Let's get C99 right first by shutdown+-p+now · · Score: 4, Informative

      Simply put, gcc beats VC on standard compliance, and VC beats gcc on optimization quality.

      Anyway, VC is primarily a C++ compiler. C support is largely legacy, and hasn't been updated for a long time now.

    19. Re:Let's get C99 right first by Shinobi · · Score: 2

      That's because Intel specifically had to introduce the GCCisms(and early on you also needed to patch serious parts of the kernel sources).

      It's still bad though, because you have seriously non-standard stuff. The whole situation is just the same as what people have complained about Microsoft for: Implementing non-standard stuff, but instead of ruthless closed-source for-profit, GCC spread theirs with a draconic ideology and religious zealotry. The GCC project in particular has shown itself to play a serious politics game and favouritism, for example in regards to the PPC970 code submitted first from Apple(declined), then by IBM(Accepted without comment, even if significant parts were the code submitted by Apple earlier).

    20. Re:Let's get C99 right first by tepples · · Score: 2

      For one thing, you'd need ABI-specific extensions to support the various different calling conventions that different "kinds" of functions have, such as interrupt handlers, 16-bit calls to BIOS to read storage devices before the 32- or 64-bit drivers have fully loaded, etc.

    21. Re:Let's get C99 right first by Goaway · · Score: 2

      Declaring variables at the beginning of their scope makes the code more readable and easier to debug.

      Not even a little! It does the absolute exact opposite!

      Why on earth would it make code more readable to declare a variable away from the place where it is actually used? That makes no sense whatsoever.

    22. Re:Let's get C99 right first by hamanu · · Score: 2

      The BIOS is allowed to patch the cpu microcode. applications are not. Allowing an application to patch the cpu microcode would be a security flaw. icc does not emit microcode. Maybe you mean to say it can do microcode-aware instruction scheduling.

      --
      every _exit() is the same, but every clone() is different.
    23. Re:Let's get C99 right first by Forever+Wondering · · Score: 2

      The Intel compiler puts MS's compiler in the dust when it comes to optimization. If I had to choose a compiler for standards compliance, I'd go with gcc. If I had to pick something to squeeze performance out of x86/amd64 binaries, I'd go with icc.

      icc is a bit touchy about the amd thing. It tends to optimize for intel and the resulting code may be sub-optimal for amd because icc knows exactly the internal implementation of the x86 arch on an intel chipset.

      There was a time (circa gcc 2.96) that icc produced vastly better code than gcc. However, gcc got a complete makeover starting with 4.0.x [punting on LALR grammar parsers and doing recursive descent, virtual register optimizing, etc.] and the code that it produces is pretty close to optimal as far as I can determine [I'm concerned with speed, so I disassemble a lot to be sure].

      Also, icc is x86 specific. Whereas gcc does a plethora of arch's. There is a disincentive [for intel] to make icc multiarch.

      --
      Like a good neighbor, fsck is there ...
  4. move on by OrangeTide · · Score: 4, Insightful

    Many of us gave up waiting on Microsoft for our development tools.

    --
    “Common sense is not so common.” — Voltaire
  5. So... by bytesex · · Score: 2

    I'm not willing to pony up 300 swiss Francs, so can anybody tell me, basically, how it is different ? Is it just the stuff that has creeped through in the last few years by means of gcc, or is it totally new ?

    --
    Religion is what happens when nature strikes and groupthink goes wrong.
    1. Re:So... by Old+Wolf · · Score: 4, Informative
    2. Re:So... by TheRaven64 · · Score: 4, Informative
      As with every other version of the C standard, you can read the draft yourself. A few things that are nice:
      • A detailed and well-thought-out set of atomic operations. I've got a diff for clang that implements these that should be committed in the next few days after a bit of tidying. Ed Schouten has written the supporting header to FreeBSD libc, so these can be used now (with fall back to GCC intrinsics for a marginally slower implementation).
      • Unicode string literals and a few functions for manipulating them.
      • _Generic() letting you write type-generic macros.
      • Anonymous structure and union members, so you can write things like struct { int tag; union { void *ptr; uintptr_t i}; } s; and then refer to s.ptr or s.i, rather than needing to provide a name for the union (this is already a GNU extension, but it's nice to have it in the standard).
      • Static assertions, so you can do things like _Static_assert(sizeof(int) == 4, "This code path should not be used in ILP64 platforms!"); and get a compile-time error if it is.
      • A _Thread_local storage qualifier for thread-local variables (equivalent to the __thread GNU extension).
      • Alignment checks and specifiers.
      • A few things from POSIX, like the x specifier in fopen() for exclusive open.

      Some of the not-so-nice features include threads.h, which is equivalent to pthreads but with a different function names (and ones that seem quite likely to cause conflicts with existing code).

      --
      I am TheRaven on Soylent News
  6. Draft available for free by FrangoAssado · · Score: 5, Informative

    For those interested, the last draft before the official version is available for free here: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf

  7. Re:At least... by 93+Escort+Wagon · · Score: 2

    Microsoft-designed "secure function" cancer?

    I'm beginning to think we need a new "law" styled somewhat after Godwin's Law - let's call it "93 Escort Wagon's Law". It goes as follows:

    "As any online discussion grows longer, the probability of someone mentioning Microsoft in a derogatory manner approaches 1."

    It might also make sense to add a "Slashdot Corollary" under which Microsoft and Apple are interchangeable.

    --
    #DeleteChrome
  8. C90 * by tapspace · · Score: 2

    I put C90 (ANSI C) on my resume, because it is more marketable. A serious employer wants to know that I know how to write C90, not just vaguely understand the C language. The fact is if your write ANSI C, it will work with just about any compiler (with the exception of any platform specific code). Many embedded compilers only support a subset of C99 anyway (usually, most, but that's the point, it's not all). ISO fussing with a new C revision is laughable.

  9. Re:C90 * by peppepz · · Score: 2

    The problem is that with C90 you have to write more platform specific code. How do you handle 64-bit integers in C90, for example?

  10. Looks like story is already dated... by ibsteve2u · · Score: 4, Informative

    The standard is known unofficially as C1X

    GCC already says:

    A fourth version of the C standard, known as C11, was published in 2011 as ISO/IEC 9899:2011. GCC has limited incomplete support for parts of this standard, enabled with -std=c11 or -std=iso9899:2011. (While in development, drafts of this standard version were referred to as C1X.)

    Syntax is everything in C.

    --
    Orwell: "In a Time of Universal Deceit, telling the Truth is a Revolutionary Act"
  11. Poul-Henning's take on this. by Anonymous Coward · · Score: 5, Informative

    https://www.varnish-cache.org/docs/trunk/phk/thetoolsweworkwith.html

    1. Re:Poul-Henning's take on this. by shutdown+-p+now · · Score: 4, Insightful

      His complaint about _Noreturn and similar keywords is silly. First, they were there 12 years ago already, in C99 - _Bool, _Complex etc. The reason for this scheme is that if they just made noreturn a keyword, existing valid C programs that use it as identifier would become illegal. On the other hand, underscore followed by capital letter was always reserved for implementations, so no conforming program can use it already. And then you can opt into more traditionally looking keywords, implemented via #define to the underscore versions, by explicitly including the appropriate header.

  12. Re:Can't we please let C die? by jcr · · Score: 4, Insightful

    You have that exactly backwards. It's C+++ that should die.

    -jcr

    --
    The only title of honor that a tyrant can grant is "Enemy of the State."
  13. Lots of Irritating Superfluous (curly) Parentheses by tepples · · Score: 2

    Declaring variables at the beginning of their scope

    But do you really want to start a new scope every time you declare a variable? Then your code would be filled with so many }}}}}}}}} that it'd look like a curlier version of Lisp.

  14. Re:Pesky space/time relavitity by 140Mandak262Jamuna · · Score: 2
    Two problems:

    The free sample in alpha centauri is in a filing cabinet in a dark basement guarded by leopards.

    Your time dilation assumes c towards Alpha Centauri, instant deceleration to 0, collect pdf and instant acceleration to c towards earth. Wont work.

    --
    sed -e 's/Chuck Norris/Rajnikant/g' joke > fact
  15. WTF is "ISO C"? by Anonymous Coward · · Score: 3, Insightful

    I spent my early years programming K&R C on Unix systems.

    When the ANSI standards were ratified, ANSI took over.

    But WTF is "ISO C"? With a core language whose goal is portability and efficiency, why would I want the language trying to can platform-specific implementations like threading? C is not a general purpose language -- it's power comes from tying to the kernels and platform libraries of the industry at the lowest levels possible to maximize performance.

    If you don't need that maximum performance, you use C++ or another high-level language.

    ANSI C is the assembler of the modern computing age, not a general purpose programming language.

    Now get off my lawn!

  16. Re:Can't we please let C die? by mario_grgic · · Score: 2

    Not sure if you are being sarcastic or not, but you sum up the problem with C++ well. It's exactly because Bjarne has forced any idea he remotely heard about into C++ standard that C++ is a complete incoherent mess of a language it is today.

    --
    As the island of our knowledge grows, so does the shore of our ignorance.
  17. Most critical software is written in COBOL by perpenso · · Score: 3

    Real mission critical stuff at Boeing? NASA? All that stuff then right?

    Actually their most critical software is probably written in COBOL, their payroll software. Without that COBOL based software nothing gets done. :-)

  18. Re:"Greater compatibility with C++ " by fnj · · Score: 2

    No, no, no. That's not the issue. C++ can automatically call any C code using 'extern "C"'. The issue is, how will C++ do *COMPILING* C source in C++ mode. C++ is not a true superset of C, so C is not a true subset of C++. Anything that makes them closer to being a super/sub set pair is a Good Thing.

  19. But... C Was Perfect... by Greyfox · · Score: 2

    Why mess with that? If you want more than that, you go with C++. Which isn't too bad as long as you avoid template metaprogramming like the plague...

    --

    I'm trying to teach myself to set people on fire with my mind... Is it hot in here?

  20. Re:Any 64-bit ints in C++? by fnj · · Score: 2

    Fucking markup. Here's a version you can read.

    #include <stdio.h>
    #include <stdint.h>
    int main(int argc, char *argv[])
    {
            int64_t a = 50000000000LL;
            int64_t b = 100000000000LL;
            int64_t c = 0;

            c = a + b;
            printf("%lld\n", c);
            return 0;
    }

    // Prints "150000000000"

  21. Re:My "Ask Slashdot" by bonch · · Score: 3, Funny

    Objective-C, of course.

  22. Re:Pesky space/time relavitity by Christian+Smith · · Score: 2

    Your time dilation assumes c towards Alpha Centauri, instant deceleration to 0, collect pdf and instant acceleration to c towards earth. Wont work.

    Is that c 9x or c 1x? Must be 9x else you wouldn't be going to Alpha Centauri to get the new c spec.