Slashdot is powered by your submissions, so send in your scoop

 



Forgot your password?
typodupeerror
×
Programming

ISO Updates C Standard 378

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)."
This discussion has been archived. No new comments can be posted.

ISO Updates C Standard

Comments Filter:
  • First post!! (Score:5, Insightful)

    by Anonymous Coward on Saturday December 24, 2011 @04:08AM (#38480358)

    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?

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

      • Re:First post!! (Score:5, Informative)

        by Anonymous Coward on Saturday December 24, 2011 @04:29AM (#38480440)

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

        • Exactly, it's not a reasonable $5 per copy (which I think will make them a lot more money than selling it for $300).
        • by 93 Escort Wagon ( 326346 ) on Saturday December 24, 2011 @05:25AM (#38480612)

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

          But these limited-edition PDFs are signed and numbered.

          • 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

        • Re:First post!! (Score:5, Insightful)

          by bunratty ( 545641 ) on Saturday December 24, 2011 @10:02AM (#38481812)
          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.
          • by surmak ( 1238244 )

            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 mi

      • Re:First post!! (Score:5, Insightful)

        by dutchd00d ( 823703 ) on Saturday December 24, 2011 @04:56AM (#38480526) Homepage

        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.

        • by Noughmad ( 1044096 ) <miha.cancula@gmail.com> on Saturday December 24, 2011 @05:02AM (#38480538) Homepage

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

        • by mirix ( 1649853 )

          This, so very much. I've always found it mindboggling to pay for standards like this.

          Pay for the work creating the standard, sure. But copies? (digital no less) wtf? Don't they want people to adopt the standard?

          I can see if it's some small industry-specific council perhaps, but the ISO?!

        • Re:First post!! (Score:5, Informative)

          by TheRaven64 ( 641858 ) on Saturday December 24, 2011 @07:28AM (#38480998) Journal
          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.
      • by Hentes ( 2461350 )

        Because it's not a book but a language standard. If you want your standards to be recognized, keep them open and free of charge.

        • The most recognized standards are those you need to pay for. When I implemented HDLC, I used the standards documents that my company bought. If companies did not adopt standards because they were too cheap to pay the $300 for the standards documents, you might have a point. Of course, that small amount of money gives a great ROI, so any company that was that cheap would not stay in business for long.
      • Re:First post!! (Score:5, Informative)

        by wzzzzrd ( 886091 ) on Saturday December 24, 2011 @07:35AM (#38481028)
        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 [thepiratebay.org].
        • Developers don't need to know the standard. Compiler writers need to know the standard.
          • Re: (Score:3, Funny)

            by Vanders ( 110092 )
            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!
        • Re:First post!! (Score:4, Informative)

          by bonch ( 38532 ) * on Saturday December 24, 2011 @01:15PM (#38483296)

          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 [stallman.org] and "voluntary pedophilia" [stallman.org]. Maybe not the best spokesperson to get behind.

          • by Myopic ( 18616 ) *

            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.

    • Re:First post!! (Score:5, Insightful)

      by symbolset ( 646467 ) * on Saturday December 24, 2011 @04:16AM (#38480384) Journal
      Actually though, most of us. Changes to the C standard are a big deal.
    • Re: (Score:3, Funny)

      by Anonymous Coward

      Do they sell them by the C-shore?

  • 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.
    • by wdef ( 1050680 ) on Saturday December 24, 2011 @04:30AM (#38480446)
      C is withering and dying? Isn't it still used more than any other language: http://langpop.com/ [langpop.com]
      • by Feltope ( 927486 ) on Saturday December 24, 2011 @04:53AM (#38480516)

        COBOL is king, always will be.

        Solid and reliable code that works period!

      • by JDG1980 ( 2438906 ) on Saturday December 24, 2011 @05:38AM (#38480654)
        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.)
        • Bad tools I can deal with, sloppy API's I can deal with, heck even the messed up compiler I can deal with. What REALLY pisses me off with c development in Windows is that MSDN offers absolutely NO way to search for api's for a specific language. Sure if you use c++, objective-c or c# you simply add "c++", etc to your search query and it works fine, but typing in "spawn process in c" causes the "c" to match "c", "c++", "objective-c" and "c#". This makes it damn near impossible to find the bindings for straig
    • by Daniel Phillips ( 238627 ) on Saturday December 24, 2011 @04:31AM (#38480448)

      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.

      • by JDG1980 ( 2438906 ) on Saturday December 24, 2011 @05:40AM (#38480658)
        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.
        • Re: (Score:3, Informative)

          by TheRaven64 ( 641858 )
          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.
      • by Richard_at_work ( 517087 ) on Saturday December 24, 2011 @07:02AM (#38480870)

        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?

        • by shutdown -p now ( 807394 ) on Saturday December 24, 2011 @08:53AM (#38481332) Journal

          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.

          • by Shinobi ( 19308 )

            VC and GCC are equally shit at standards compliance *Grumbles*

            If either is specified to be used in a project, it means extra work to adapt existing portable code that is strict ISO C to perform well when compiled with either of them.

            ICC has quite good ISO C compliance, and the whole thing regarding AMD processors not being optimized for was overexaggerated(and there are some technically valid reasons for it: Some of the intrinsics handling involves microcode level, and Intels and AMD's can look very differe

      • by rev0lt ( 1950662 )
        So, you have no other choice of C compilers for Windows?
    • move on (Score:5, Insightful)

      by OrangeTide ( 124937 ) on Saturday December 24, 2011 @04:34AM (#38480458) Homepage Journal

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

    • by nzac ( 1822298 )

      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.

      • Re: (Score:2, Redundant)

        by Dwedit ( 232252 )

        The big problem is that you can't compile C programs that make use of GCC extensions using Visual C++. This includes even the most basic stuff, like declaring variables in the middle of your code. It's actually a GCC extension to C, despite being a standard feature of C++.

        The only way to compile such programs on Visual Studio is to force the compiler to use C++ mode instead of C mode. Then you get a bunch of compiler errors, because C++ is a different language than C, and gives errors when you assign poi

        • by Anonymous Coward on Saturday December 24, 2011 @05:50AM (#38480680)

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

        • by kthreadd ( 1558445 ) on Saturday December 24, 2011 @06:04AM (#38480720)

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

          • by tepples ( 727027 )
            Is it wrong to rely on things that were "GCC extensions" before the day in 1999 when C99 passed but have been part of C since C99?
    • by mwvdlee ( 775178 )

      Microsoft Visual Studio doesn't support a lot of things in whatever language.
      It's hardly the standard by which to judge programming languages.
      Although the fact that it is included in some form basically means the language is imporant enough that Microsoft couldn't replace it with one of their own languages.

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

      • The position on native (read: C++) vs managed has been effectively reversed in Win8. All new APIs are implemented as native, and have direct C++ bindings. Win8 dev preview that you mentioned has VS11 Express pre-beta pre installed that only supports targeting Metro for all languages, not just for C++. That's because the purpose of dev preview is to showcase Metro app development. Full version of VS supports everything supported in past releases, and a prerelease can be separately downloaded and installed on

      • by tepples ( 727027 )

        The pre-release Visual Studio contained in the Windows 8 technical preview won't even allow you to write non-Metro applications

        If you can't get Metro applications anywhere but the Store, then how are you supposed to test Metro applications that you've compiled?

  • by bytesex ( 112972 ) on Saturday December 24, 2011 @04:48AM (#38480504) Homepage

    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 ?

    • Re:So... (Score:5, Informative)

      by Old Wolf ( 56093 ) on Saturday December 24, 2011 @05:32AM (#38480638)
    • Re:So... (Score:5, Informative)

      by TheRaven64 ( 641858 ) on Saturday December 24, 2011 @07:45AM (#38481068) Journal
      As with every other version of the C standard, you can read the draft yourself [open-std.org]. 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).

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

        There was already a macro for that, involving declaring an array whose size is 1 when true or -1 (and thus invalid in a way that produces a diagnostic) when false.

      • by Shinobi ( 19308 )

        If my very cursory reading of threads.h is correct, it's designed to provide better portability between platforms, without having to use a lot of POSIXisms, for example some embedded stuff that have no use for it, but can make use of threading.

  • by FrangoAssado ( 561740 ) on Saturday December 24, 2011 @05:20AM (#38480594)

    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 [open-std.org]

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

    • 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?
  • by ibsteve2u ( 1184603 ) on Saturday December 24, 2011 @05:53AM (#38480686)

    The standard is known unofficially as C1X

    GCC already says: [gnu.org]

    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.

  • by Anonymous Coward on Saturday December 24, 2011 @06:07AM (#38480728)

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

    • by shutdown -p now ( 807394 ) on Saturday December 24, 2011 @09:07AM (#38481404) Journal

      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.

  • WTF is "ISO C"? (Score:3, Insightful)

    by Anonymous Coward on Saturday December 24, 2011 @10:31AM (#38481992)

    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!

  • by Greyfox ( 87712 ) on Saturday December 24, 2011 @12:26PM (#38482902) Homepage Journal
    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...

Serving coffee on aircraft causes turbulence.

Working...