16

C99 still isn't supported by many compilers, and much of the focus is now on C++, and its upcoming standard C++1x.

I'm curious as to what C will "get" in its next standard, when it will get it, and how it will keep C competitive. C and C++ are known to feed on one another's improvements, will C be feeding on the C++1x standard?

What can I look forward to in C's future?

Johan Bezem
  • 2,582
  • 1
  • 20
  • 47
Matt Joiner
  • 112,946
  • 110
  • 377
  • 526
  • 4
    Is there even a push for another C revision? Anything further I can think of that someone might want in C is actually a hint that they should move to a higher-level language... – Nicholas Knight Jul 27 '10 at 05:38
  • 6
    No C still plays a very important role. I'm interested in what changes are planned to keep it applicable and up to date. Becoming higher level I don't think is part of that. – Matt Joiner Jul 27 '10 at 05:44
  • I never said it didn't. But I fail to see what is necessary to keep it "applicable" or "up to date". Most software still runs on infrastructure written in C, and that's not going to change anytime soon. – Nicholas Knight Jul 27 '10 at 06:43
  • Yes, so any future changes are naturally of great interest :) – Matt Joiner Jul 27 '10 at 06:59
  • 1
    A summary of greater detail than Wikipedia would be nice. The draft is such a bore to read. – Matt Joiner Jul 27 '10 at 07:03
  • 1
    @Nicholas Knight - I think it's a lot of little things that recently-raised programmers miss, not huge sweeping changes. eg. the ability to have a typed compile-time-constant qualifier. It's become a de-facto standard to litter code with things like `#define NUM_THINGOS 8`, so we don't even notice it any more. But it makes me cringe to do it, and it'd be nice to be able to do `ctconst size_t NUM_THINGOS 8`. – detly Jul 27 '10 at 07:08
  • 3
    Also, if **I** know how many thingos are in that static array, why can't the compiler? I just told it in little sqare brackets! Why can't I use the number of values of that enum I just declared instead of adding a dummy end value? I mean, these are all little annoyances, but they're all compile-time-fixable idiosyncrasies, the fixing of which would have no runtime effect. – detly Jul 27 '10 at 07:10
  • @detly: compile-time const is a valid compiler optimization if done correctly, the compiler does know how big your static array is (try sizeof() on it), and I think you're using enums wrong. Sounds to me like you want things that are either already there, or shouldn't be in the first place. – Nicholas Knight Jul 27 '10 at 07:22
  • @Nicholas Knight - you cannot, for example, declare a static array with a `const` size, only a compile time constant. Same with case labels, I think. `sizeof` I should have known, silly me. It's not uncommon to want to iterate over all values of an enumerated type. – detly Jul 27 '10 at 07:42
  • 2
    Anyway, I don't want to start a flamewar about this, my point was that it's possible to tweak the language without making changes that would necessitate using a "high-level" language. – detly Jul 27 '10 at 07:46
  • There hardly are any "higher level" languages, just ones with more features tacked on. The ones that are significantly improved are the ones that practically nobody uses. – XTL Feb 16 '12 at 09:54
  • @XTL: C has some warts. It could be possible to fix them and make other improvements to the language now that 40 years have passed, but little has changed in about 25 years. Of course there are plenty of reasons for this, but one can dream. – Matt Joiner Feb 16 '12 at 18:16

5 Answers5

9

The ISO/IEC 9899:2011 standard, aka C11, was published in December 2011.

The latest draft is N1570; I'm not aware of any differences between it and the final standard. There's already a Technical Corrigendum fixing an oversight in the specification of __STDC_VERSION__ (now 201112L) and the optional __STDC_LIB_EXT1__ (now 201112L).

Keith Thompson
  • 254,901
  • 44
  • 429
  • 631
Jukka Suomela
  • 12,070
  • 6
  • 40
  • 46
6

I was typing a list of of features, but noticed the Wikipedia page on C1X has a pretty complete listing of all proposed changes.

On the ISO C working group posts 'after meeting' mailings on their website. One of the more interesting is this Editor's Report.

schot
  • 10,958
  • 2
  • 46
  • 71
  • 5
    I'd be interested in hearing more detail than the Wikipedia page provides. Especially about the new character types. Will there be a whole family of functions to manipulate strings of these types (ala `strstr`, etc.) or just the functions for converting back and forth to multibyte strings? As for threads, is the only addition the `__thread` keyword? Or might there be a new portable threads API with less complexity and more sanity than POSIX threads? – R.. GitHub STOP HELPING ICE Jul 27 '10 at 06:47
  • 1
    On top of that, I wonder how C1x threads and POSIX threads might interact. It would be very unfortunate if the underlying implementation could not be the same, accessed either through the simple API which would be implemented across a range of systems (C1x) or the feature-rich API just available on POSIX environments. – R.. GitHub STOP HELPING ICE Jul 27 '10 at 07:29
  • I think it's highly likely it's an interface wrapper, and a subset or exact replica of pthreads. – Matt Joiner Jul 27 '10 at 09:18
  • 3
    Nobody would use C's threads if they were wildly different to POSIX threads, which are already widely used, documented and understood. – dreamlax Jul 27 '10 at 09:22
  • 2
    I've heard the C1x and C++11 worked hard to synchronize their thread models and atomics. @R They added the _Atomic keyword. – emsr Jul 10 '11 at 00:08
5

Here's a summary from the Wikipedia page:

  • Alignment specification (_Align specifier, alignof operator, aligned_alloc function)
  • Multithreading support (_Thread_local storage-class specifier, <threads.h> header including thread creation/management functions, mutex, condition variable and thread-specific storage functionality)
  • Improved Unicode support (char16_t and char32_t types for storing UTF-16/UTF-32 encoded data, including the corresponding u and U string literal prefixes and conversion functions in <uchar.h>)
  • Removal of the gets function
  • Bounds-checking interfaces (Annex K)
  • Analyzability features (Annex L)
Gabe
  • 84,912
  • 12
  • 139
  • 238
4

Probably the best place to find the current status would be to look at the latest draft of the new version of the C standard. Warning: though it's coming directly from the committee, the server behind that link isn't always the most responsive...

Johan Bezem
  • 2,582
  • 1
  • 20
  • 47
Jerry Coffin
  • 476,176
  • 80
  • 629
  • 1,111
4

I looks like gcc as of 4.6 is starting to look at C1x. They claim to have:

  • Static assertions (_Static_assert keyword)
  • Typedef redefinition
  • New macros in <float.h>
  • Anonymous structures and unions
Matt Joiner
  • 112,946
  • 110
  • 377
  • 526
emsr
  • 15,539
  • 6
  • 49
  • 62