The founder and core developer of curl, Daniel Stenberg, blogged that he is considering whether to use the C language standard used by curlUpgrading from C89 to C99.

Daniel said that he has observed many popular C language open source projects moving forward and upgrading the C language standard used to C99 or later, such as Linux, Git and other projects. And there’s also a lot of discussion on the curl mailing list about upgrading the C language standard, especially now that curl v8 is scheduled for spring 2023, so in theory this might be a good time to make some changes.

If you want to upgrade the C language standard to C99, you need to consider which C99 features can improve projects like curl. Some of the features that Daniel says he can think of that might have a positive impact on the curl code are:

  • //note
  • __func__predefined identifier
  • exist<stdbool.h>Use boolean type in
  • designated structure initializer
    empty macro parameter
  • exist<inttypes.h>and<stdint.h>Extended integer types are used in
  • Flexible array members (zero size arrays)
  • inline function
  • Integer constant type rules
  • Mix declarations and code
  • long longTypes and library functions
  • snprintf()function family
  • Trailing commas are supported in enum declarations
  • Variadic macros
  • variable length array

Of course, there are many other features that developers can use, but the question is whether they really need these features. And for some of the features mentioned above, Daniel said that they already have good alternatives, and other features are either irrelevant or may be distracting.

Therefore, Daniel believes that if all the new features of C99 were adopted for the curl project right away, it would result in rewriting most of the code, introducing bugs. In addition, there is another problem. If you really want to upgrade the C language standard,Should one upgrade directly to C11 instead of staying at C99.

In the discussion in the curl community about upgrading the C language standard, no one can clearly articulate the benefits that the upgrade will bring to the curl project. Daniel said that the risk they see at the moment is that everyone gets caught up in discussions and changes that are very irrelevant to the project, which may not actually make the project go very far. Be it functionality or quality/security.

Daniel believes that there are many better things to do and more worthwhile efforts to put energy into that can actually improve the project and move it forward. Things like improving test suites, increasing test coverage, and ensuring more code is executed by fuzzers.

Daniel decided to start with curl 8, they willRequires compiler support for 64-bit data types, mainly to see it in action. This was not a feature that existed in the original C89 version, but was introduced in C99. There are currently no modern compilers that do not support this feature. He thinks this may be the way to continue to adapt and use certain “post-C89 features”. By picking specific features and then slowly adapting to them over time.

In the end, Daniel said that rewriting curl in any other language is not considered.

further reading

#author #curl #considers #upgrading #language #standard #curl #News Fast Delivery

Leave a Comment

Your email address will not be published. Required fields are marked *