Hello,

New mail thread to make this topic more visible. The idea of switching to C99 as the base level for curl code when we go version 8 (March 2023) is attractive to me. I figure compilers have had some time to get compliant and find widespread use by now!

I added a PR just now to (primarly as a test) enforce C89 on the code when gcc is used, and it shows that we are already a bit sloppy in C89 compliance in several areas of our code base: https://github.com/curl/curl/pull/9542

But what does "going C99" mean for us? The C99 standard brought a whole busload of different new features to the language compared to C89, and some of them are:

 — `//` comments
 — `__func__` predefined identifer
 — boolean type in `<stdbool.h>`
 — designated struct initializers
 — empty macro arguments
 — extended integer types in `<inttypes.h>` and `<stdint.h>`
 — fexible array members (zero size arrays)
 — inline functions
 — integer constant type rules
 — mixed declarations and code
 — the `long long` type and library functions
 — the `snprintf()` family of functions
 — trailing comma allowed in enum declaration
 — vararg macros
 — variable-length arrays

I am not entirely convinced we want to go all-in and totally crazy on all these fronts immediately, and I think having an idea what we want in terms of code style is a good idea to have thought about before the flood gates open.

At the same time, if we accept C99 it will be hard to enforce restrictions with compilers and checksrc certainly will not stop most of the things in that list (the //-comments perhaps being the single exception).

Thoughts?

--

 / daniel.haxx.se
 | Commercial curl support up to 24x7 is available!
 | Private help, bug fixes, support, ports, new features
 | https://curl.se/support.html
-- 
Unsubscribe: https://lists.haxx.se/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html
  • C99 Daniel Stenberg via curl-library
    • Re: C99 Christoph M. Becker via curl-library
      • Re: C99 Daniel Stenberg via curl-library
    • RE: C99 Marcel Raad via curl-library
    • Re: C99 Emil Engler via curl-library
    • Re: C99 Kevin R. Bulgrien via curl-library
      • Re: C99 Ben Greear via curl-library
        • Re: C99 Dan Fandrich via curl-library

Reply via email to