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?
On 26/08/2021 05:52, Сергей Басыров wrote:
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?
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.Thank you David!
четверг, 26 августа 2021 г. в 11:05:52 UTC+3, David Brown:
On 26/08/2021 05:52, Сергей Басыров wrote:
Hello everyone!You usually don't need to do anything.
What do you think about code migration of legacy C code to new C standarts?
And what tools can help to do that?
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.
Thank you David!
So, I can just change "-std" option of gcc and C program will work better?
On 26/08/2021 12:51, Sergey Basyrov wrote:Okay. I understood.
четверг, 26 августа 2021 г. в 11:05:52 UTC+3, David Brown:
On 26/08/2021 05:52, Сергей Басыров wrote:
Hello everyone!You usually don't need to do anything.
What do you think about code migration of legacy C code to new C standarts?
And what tools can help to do that?
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.
Thank you David!
So, I can just change "-std" option of gcc and C program will work better?
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.
Sysop: | DaiTengu |
---|---|
Location: | Appleton, WI |
Users: | 1,030 |
Nodes: | 10 (0 / 10) |
Uptime: | 55:17:22 |
Calls: | 13,348 |
Files: | 186,574 |
D/L today: |
87 files (21,238K bytes) |
Messages: | 3,358,432 |