You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
C89 (and C90) is a very old language standard which has more recent successors that bring improvements and are wideley supported. Some features from newer standards are missing which makes it sometimes cumbersome to write code. Some strange relics like not allowing variable declaration within a for look (for(int i=0;;) is not allowed), forbidding mixed declarations and code, or having variable declarations without a type (implicit int) are traps to produce bugs.
I could not find a place with a formal definition of the minimal C standard. Using C99 code fails the CI.
Describe the solution you'd like
Increase the minimum C standard to C11.
Describe alternatives you've considered
Stay with C89/C90 indefinitely. This means Zstd cannot profit from C language improvements.
Compiler developers treat code with older C standards less strict. This might lead to less warnings or errors that would otherwise revealed potential bugs.
"Given that C89 code is unlikely to be actively maintained, I think we should be permissive by default in that mode. People compiling with an old -std flag are presumably doing it to keep old code compiling, and it seems appropriate to respect that." (GCC mailing list)
Contributors might be surprised to find out they have to write C89/C90-compatible code.
The text was updated successfully, but these errors were encountered:
gruenich
changed the title
Increase minimum C standard from C89 to C11
Increase minimum C standard from C89/C90 to C11
Feb 11, 2024
A compression standard is only useful if one can expect it to be supported by the receiver side. As a consequence, the promise that the Zstandard reference library can be compiled on any platform, and therefore the Zstandard format can be decoded on any platform, is a fairly important one for the health of the ecosystem.
Therefore, we still intend to preserve C90 compatibility of the code base for the foreseeable future.
Do you have any data that C90 coveres considerably more platforms compared to C11? The Kernel's move went without noticeable fallout. I thought it could be considered for Zstd 1.6, 1.7, or even 2.0.
I understand your position, feel free to close this issue as won't fix.
Is your feature request related to a problem? Please describe.
C89 (and C90) is a very old language standard which has more recent successors that bring improvements and are wideley supported. Some features from newer standards are missing which makes it sometimes cumbersome to write code. Some strange relics like not allowing variable declaration within a for look (
for(int i=0;;)
is not allowed), forbidding mixed declarations and code, or having variable declarations without a type (implicitint
) are traps to produce bugs.I could not find a place with a formal definition of the minimal C standard. Using C99 code fails the CI.
Describe the solution you'd like
Increase the minimum C standard to C11.
Describe alternatives you've considered
Stay with C89/C90 indefinitely. This means Zstd cannot profit from C language improvements.
Additional context
"Given that C89 code is unlikely to be actively maintained, I think we should be permissive by default in that mode. People compiling with an old -std flag are presumably doing it to keep old code compiling, and it seems appropriate to respect that." (GCC mailing list)
The text was updated successfully, but these errors were encountered: