Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Migration from C89/C99 to C11/C17

254 views
Skip to first unread message

Сергей Басыров

unread,
Aug 25, 2021, 11:52:19 PM8/25/21
to
Hello everyone!

What do you think about code migration of legacy C code to new C standarts?

And what tools can help to do that?

David Brown

unread,
Aug 26, 2021, 4:05:52 AM8/26/21
to
You usually don't need to do anything.

Code that is good C99 is almost certainly equally good as C11, as the
changes between C99 and C11 are primarily the addition of features such
as atomics and threading, generics, and standardisation of some common
compiler extensions. C17 is just a bug-fix of C11, and the changes only
affect quite obscure corner cases (AFAIUI).


The big difference was C89/C90 to C99. Again, most of it was new
features that are not going to affect existing code unless you happen to
use some of the new keywords as identifiers. But there are occasional
differences, such as the types of some integer constants and possible
differences in rounding for division with negative integers.


If you have specific questions or code that you'd like help with,
comp.lang.c is probably a better newsgroup.

Sergey Basyrov

unread,
Aug 26, 2021, 6:51:51 AM8/26/21
to
четверг, 26 августа 2021 г. в 11:05:52 UTC+3, David Brown:
Thank you David!

So, I can just change "-std" option of gcc and C program will work better?

David Brown

unread,
Aug 26, 2021, 8:50:03 AM8/26/21
to
No, it will work exactly alike (baring these very few corner cases).
You don't get the advantage of newer C standards unless you write code
that uses them. And most of the benefits are about making it easier to
write clearer and safer C code, there will normally be no effect on the
speed, size or correctness of the resulting compiled code. C99 lets you
write better source code than C90, it does not let you get better
results from old code.


Sergey Basyrov

unread,
Aug 26, 2021, 11:10:27 AM8/26/21
to
четверг, 26 августа 2021 г. в 15:50:03 UTC+3, David Brown:
Okay. I understood.

Thank you very much!


0 new messages