[D66] What is the difference between C89 and C99?

René Oudeweg roudeweg at gmail.com
Sun Jan 15 19:56:05 CET 2023


<https://www.quora.com/profile/Mark-Sheldon-15>
(Toepasselijk, ik kreeg met de c99 standaard een associatie met d66... 
Flauwekul natuurlijk, maar om aan te geven dat er niet 1 standaard van 
de C taal is.)


Associate Teaching Professor at Tufts University (2012–present)Author 
has 492 answers and 778.3K answer viewsUpdated Sep 10 
<https://www.quora.com/Out-of-all-the-C-standards-K-R-C89-90-C99-C11-which-standard-is-the-most-used-on-production/answer/Mark-Sheldon-15>
Related


Out of all the C standards (K&R, C89/90, C99, C11), which standard is 
the most used on production?
<https://www.quora.com/Out-of-all-the-C-standards-K-R-C89-90-C99-C11-which-standard-is-the-most-used-on-production>

I can’t say what’s most widely used in industry, but, since the 
standards are pretty much backward compatible, I would assume folks use 
the newest standard unless they have a code base and developers who want 
a consistent standard for a project.

The Linux kernel is not standardized on an ANSI C standard, but is 
actually standardized on the GNU compiler collection (gcc). They say any 
gcc version after some thing (I can’t recall which) works. That’s 
because Linus wanted to use GNU extensions to C (or what were extensions 
when he needed them). For example, the Linux kernel uses various gcc 
compiler attributes in declarations.

I have often required my students in systems programing classes to use 
the older C89 standard. Not because the newer features aren’t useful, 
but because requiring declarations at the start of a block corresponds 
to what what they’ll see when we look at the assembly code output (space 
will be allocated on block entry). And perhaps out of some nostalgia :-) 
I also find it helps some students document and think about their code 
better. If you put all the variable declarations at the top of the 
block, it’s an opportunity to think about variable names and to notice 
that your function is getting rather long and complicated. Many students 
don’t think through their algorithm before they code, and then they 
introduce variables as they are forced to, picking horrible names and 
not noticing opportunities for breaking complex activities into simpler 
components (functions). Nothing like 16 lines of variable declarations 
to suggest that there might be a lot going on here!

Aside on student approaches to variable names: I once had a student 
assignment (written in C++) in which there was a class data member named 
“counterB”. It didn’t say what it was counting, and there was no 
“counterA” anywhere. I asked the student what was up, and they said “I 
originally had counters A and B, but then I realized I didn’t need A.” 
As I recall, the student 1 week after submitting the assignment, 
couldn’t recall what either counter was for, and so we had a nice 
discussion about naming. We also had a discussion about data members: 
this particular item was being used as an ersatz global variable, which 
made several member functions non-modular. Clients had to carefully call 
them in a particular order, even though there was no logical reason for 
them to be ordered at all. Naturally, our testing code didn’t comply :-)

One newer feature we do use are flexible array members, which came with 
the C99 standard. I’m sure there are others, but this is what leapt to mind.

4K views
View upvotes

https://www.quora.com/What-is-the-difference-between-C89-and-C99

 1. C89 Language support only 32 Keywords
 2. C99 support 37 keyword.(all c89 keyword with 5 other(1. boolean 2.
    imaginary 3. complex 4. inline 5. restrict ) )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.tuxtown.net/pipermail/d66/attachments/20230115/c2000c98/attachment.html>


More information about the D66 mailing list