Live data from Hacker News

C Finally Gets A New Standard

drdobbs.com

21–30 of 73 posts

Re: C Finally Gets A New Standard

#21
post #11
post #5

Earlier quoted context omitted.

C/C++ is used to build the fundation of pretty much everything you use every day. I don't think a fast moving standard would be a good thing.

> C/C++ This is specifically about the C programming language. Can we not conflate it with a different language entirely, at least in this comment thread?

I was under the impression the C++ standard moves in lockstep with C so that all valid C programs should also be valid C++ programs.

Re: C Finally Gets A New Standard

#23
post #21
post #11

Earlier quoted context omitted.

> C/C++ This is specifically about the C programming language. Can we not conflate it with a different language entirely, at least in this comment thread?

I was under the impression the C++ standard moves in lockstep with C so that all valid C programs should also be valid C++ programs.

I believe that has not been true for a long time, at the very least because some things are keywords in C++ that would be valid identifiers in C.

Re: C Finally Gets A New Standard

#24
post #14
post #13

Earlier quoted context omitted.

The whole _Keyword thing is to make it easier to port from older C standards to the new standard. It's not really supposed to be programmer-visible, only a workaround for compilers. There is an extensive explanation about the reasoning behind this solution in the spec. Read that and come back if you still have a problem with making forward-compatibility hacks.

On a similar note, what is up with thrd_timedout, thrd_success, thrd_busy, thrd_error, thrd_nomem? Why no ea's?

That's horrible. I read it the first time as "third success." At least "mtx" is a little easier to see (though still quite silly).

Can anyone defend this?

Re: C Finally Gets A New Standard

#25
post #23
post #21

Earlier quoted context omitted.

I was under the impression the C++ standard moves in lockstep with C so that all valid C programs should also be valid C++ programs.

I believe that has not been true for a long time, at the very least because some things are keywords in C++ that would be valid identifiers in C.

Yea, after looking into it they don't seem to be completely compatible anymore. I have known many people to use a C++ compiler when writing C code, but it looks like that restricts you to a subset of C.

They do try and stay reasonably consistent so for example Long Long moved from C to C++. And C99 has reduced some other incompatibilities by incorporating C++ features such as // comments and mixed declarations and code.

http://en.wikipedia.org/wiki/Compatibility_of_C_and_C%2B%2B

Re: C Finally Gets A New Standard

#26
post #15

My biggest problem with the new standard is the awkward naming of the threading functions. "mtx" over "mutex" saves a whole 2 bytes. Now what's up with that? Trying to avoid a namespace clash with some existing widely used library or something?

That's usually something that bothers me about C and it's libraries. I don't see the point in saving those bytes when we aren't really typing them anymore (because of modern text editors and IDEs.) Abbreviation makes the code look uglier and more cryptic, I know that appeals to some coders, but not me.

Re: C Finally Gets A New Standard

#27
post #15

My biggest problem with the new standard is the awkward naming of the threading functions. "mtx" over "mutex" saves a whole 2 bytes. Now what's up with that? Trying to avoid a namespace clash with some existing widely used library or something?

Haven't read the document yet, so I don't know if there's a rationale for naming.

It might simply be racial memory, from the days of linkers with eight character symbols (and the initial underscore ate one of them). It's hard to believe we actually wrote software under those limitations.

Re: C Finally Gets A New Standard

#28
post #15

My biggest problem with the new standard is the awkward naming of the threading functions. "mtx" over "mutex" saves a whole 2 bytes. Now what's up with that? Trying to avoid a namespace clash with some existing widely used library or something?

Back when C was first pioneer'd this was an issue. However this is the 21st century and yes we could have better full names but the standard from before is kept for consistency. I think deprecation and renaming of everything is out of the question at this point as companies and developers have invested considerable amounts of time in building applications using the good ole "fprintf" or "malloc".

I wonder what the ramifications would be if someone went through and properly named the functions.

Re: C Finally Gets A New Standard

#29
post #15

My biggest problem with the new standard is the awkward naming of the threading functions. "mtx" over "mutex" saves a whole 2 bytes. Now what's up with that? Trying to avoid a namespace clash with some existing widely used library or something?

If you don't like it use a typedef to make your code more "readable". Or a macro that will replace every occurrence of mutex in your code with mtx.

However if you want to share your code with other people, I would go with the standard names.

Post reply on HN