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)."
First post!! (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?
Re: (Score:2)
Not really, a lot of books cost money. Why would this one be different?
Re:First post!! (Score:5, Informative)
Oh? $300? For a PDF file? Heh.
Re: (Score:2)
Re:First post!! (Score:5, Funny)
Oh? $300? For a PDF file? Heh.
But these limited-edition PDFs are signed and numbered.
Re: (Score:3)
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)
Re: (Score:3)
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: (Score:3)
Not yet, the C++ standard is on there though:
https://thepiratebay.org/torrent/6670023/Official_Standard_C__0x_C__11_CPP_CXX_ISO_IEC_14882_2011 [thepiratebay.org]
Re:First post!! (Score:5, 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.
Re:First post!! (Score:5, Funny)
The new standard have been on display for free at the Alpha Centauri planning office for the last fifty years.
Re: (Score:2)
Re: (Score:3)
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.
Re: (Score:3)
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.
Re: (Score:3)
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
Re: (Score:2)
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)
Re: (Score:2)
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.
Re: (Score:2)
Re:First post!! (Score:5, Informative)
Grab the original file from here [thepiratebay.org].
Re: (Score:2)
Re: (Score:3, Funny)
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)
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.
Re: (Score:3)
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)
Re: (Score:3, Funny)
Do they sell them by the C-shore?
Re:First post!! (Score:5, Funny)
yes, if you have 300 clams.
Re:First post!! (Score:4, Funny)
Let's get C99 right first (Score:2, Informative)
Re:Let's get C99 right first (Score:5, Informative)
Re:Let's get C99 right first (Score:4, Insightful)
COBOL is king, always will be.
Solid and reliable code that works period!
Re: (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?
Most critical software is written in COBOL (Score:4)
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. :-)
Re:Let's get C99 right first (Score:5, Interesting)
Re:Let's get C99 right first (Score:5, Insightful)
Re: (Score:2)
Re:Let's get C99 right first (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#?
Re: (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
Re:Let's get C99 right first (Score:5, Informative)
Microsoft
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) [wikipedia.org].
Re: (Score:2)
Yes and no – it's more that for programming applications, a higher level language is a good idea –not dealing with memory management and every low level detail is exactly what you want there. This is why Apple keeps taking Objective-C more and more away from C too (though it's still way closer - still a strict superset - than most HLLs).
Don't get me wrong – C is a fine language for coding OSes, non-safety-critical embedded systems, etc in. But there's absolutely no denying that C# is bet
Re:Let's get C99 right first (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.
Re:Let's get C99 right first (Score:4, Informative)
Re: (Score:3, Informative)
Re:Let's get C99 right first (Score:5, 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?
Re:Let's get C99 right first (Score:5, 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.
Re: (Score:2)
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
Re: (Score:2)
move on (Score:5, Insightful)
Many of us gave up waiting on Microsoft for our development tools.
Re: (Score:3)
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)
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
Re:Let's get C99 right first (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.
Re:Let's get C99 right first (Score:4, Insightful)
If your program relies on the presence of GCC extensions, you did it wrong in the first place.
Re: (Score:2)
Re: (Score:2)
That is one of the reasons why I find so many FSF supporters to be such hypocrits, they blather on about standards compliance, yet they use and abuse GCC extensions etc. The Linux kernel is horribly tainted in that way.
Linux can be compiled using the Intel C compiler [linuxjournal.com]
See include/linux/compiler*.h in your kernel source
Re: (Score:3)
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
The GCC project didn't try to patent IsNot (Score:2)
The whole situation is just the same as what people have complained about Microsoft for: Implementing non-standard stuff
Not necessarily. The GCC project doesn't try to patent [slashdot.org] language extensions so that others can't implement the extension compatibly, such as using the name "IsNot" for a reference identity operator.
Re: (Score:2)
Patenting is not the same thing as shoddy standards-compliance/developing and extending non-standard stuff.
Also, I did point out Microsofts ruthless for-profit mentality AS OPPOSED to FSF's religious zealotry.
Re: (Score:2)
You can't write an OS kernel in standard C anyway. It's in some ways inherently lower level stuff.
What would be the obstacle to writing an OS kernel in C99? What would one need the extensions for?
Re: (Score:3)
Lots of Irritating Superfluous (curly) Parentheses (Score:3)
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.
Re: (Score:3)
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.
Re: (Score:2)
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.
Re: (Score:2)
Fortunately, there are alternatives to Visual Studio even on Windows.
Re: (Score:2)
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
Re: (Score:2)
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?
Comment removed (Score:4, Insightful)
Re: (Score:2)
You should not use Microsoft Visual Studio for writing programs since it is non-free.
So is the BIOS or EFI of every computer sold on the mass market. So is the software running on the microcontroller in your computer's mouse. What workaround do you recommend?
So... (Score:3)
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)
http://en.wikipedia.org/wiki/C1X [wikipedia.org]
Re:So... (Score:5, Informative)
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 asserts have been around for a long time (Score:2)
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.
Re: (Score:2)
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.
Re: (Score:2)
I'd like to see them standardize the interaction between alloca and VLAs.
And are VLAs more than just a type-safe version of alloca?
Draft available for free (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 [open-std.org]
C90 * (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.
Re: (Score:2)
Re: (Score:2)
C90 does not contain a standard type that has a 64-bit range. C99 defines long long, which must have a range greater than or equal to a 64-bit binary number. It also defines int64_t and uint64_t, which must have exactly the range of a 64-bit binary number. More usefully, it also defines [u]intptr_t, which must have the same size as void*. There is no C90 integer type that is guaranteed to be the same size as a pointer, and the fact that a lot of people assume that sizeof(long) == sizeof(void*) is one of
Fail-fast pointer types (Score:2)
the fact that a lot of people assume that sizeof(long) == sizeof(void*) is one of the things most likely to be responsible for code not being portable.
The following is technically not portable, as it's possible for an implementation to choose types that make it fail. But at least it fails fast [wikipedia.org], using an idiom for a static assertion that works even on pre-C11 compilers:
I wouldn't hire anyone who wrote C90 these days. There's simply no excuse for it.
Other than a major compiler publisher's tools not fully supporting any standard newer than C90, perhaps?
Re: (Score:2)
There is nothing in C90 that forbids 64-bit integers.
It doesn't forbid them but it doesn't standardise them either. Whether they are provided or not and the mechanism used to provide them is up to the individual implementation and as such any code that relies on them becomes implementation dependent.
Any 64-bit ints in C++? (Score:2)
Re: (Score:3)
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;
}
Looks like story is already dated... (Score:5, Informative)
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.
Poul-Henning's take on this. (Score:5, Informative)
https://www.varnish-cache.org/docs/trunk/phk/thetoolsweworkwith.html
Re:Poul-Henning's take on this. (Score:5, 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.
WTF is "ISO C"? (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!
But... C Was Perfect... (Score:3)
Re: (Score:2)
Re: (Score:3)
Why would Dennis Ritchie have anything against it?
Re: (Score:3)
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.
Re: (Score:2)
I think we can generalise it a bit better than that.
"As any online discussion grows longer, the probability of someone mentioning anyone or anything in a derogatory manner approaches 1."
And just those two and no others, because no-one ever says mean things about (let's say
Re: (Score:2)
"As any online discussion grows longer, the probability of someone mentioning Microsoft in a derogatory manner approaches 1."
I think we can generalise it a bit better than that.
"As any online discussion grows longer, the probability of someone mentioning anyone or anything in a derogatory manner approaches 1."
It's actually a variant of the typing monkey thing: As any online discussion grows longer (by monkeys typing on their keyboards), the probability of some monkey mentioning *anything* approaches 1.
Re: (Score:2)
No, no, no. This riff only applies to a memoryless process. Long discussion threads are more like star formation. Once you get above a critical mass of Gates, Jobs, Portman, Hitler, Netcraft, emacs, vi, fiat currency, Russian dyslexia, and dcxk intelligent thought can only form at the event horizon, and the fragment emitted is barely visible against the entropic background.
Re: (Score:2)
Comment removed (Score:5, Insightful)
Re: (Score:2)
Re: (Score:3)
Re: (Score:2)
It is, because it helps write libraries in C which remain usable from C++.
Re: (Score:2)
Re: (Score:3)
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.
Re: (Score:3, Funny)
Objective-C, of course.