[sr-dev] RFC: C standard requirements

Daniel-Constantin Mierla miconda at gmail.com
Mon Apr 27 18:05:37 CEST 2020


Hello,

(cross-posting because it is relevant to know where users need to run
Kamailio as well as what developers tend to use for coding, but replies
can go to one or the other list).

Somehow I tried to stay close to ANSI-C/C90 with C coding style, for the
reason of being compatible as much as possible with old compiles and
niche/embedded systems. But I noticed that there are couple of C99
extensions in the core, like inline functions, variadic macros (the
debugging macros), use of 'long long' or line comments starting with
"//" (not so many, but still such comment style is used). Although I
haven't searched for occurrences in core, but I remember seeing
designated initializers (or initializing a structure by field names).
These are part of C99, as listed by:

  * https://en.wikipedia.org/wiki/C99#Design

Although likely GCC had some of them like custom extensions before the
standard was out.

On the other hand, newer standard C11 made some of those extensions
optional:

  *
https://en.wikipedia.org/wiki/C11_(C_standard_revision)#Optional_features

So, my email here is to figure out if we should consider C99 as the
requirement for adding C code or be more restrictive because there are
still cases of usage on very specific systems that do not have such C
compiler. We can eventually make a list of what is accepted or not from
the recent versions of C standard to stay as much as possible portable
across Unix'es.

>From develeopers perspective, it would be good to learn if they use (in
other projects, etc.) extensions of the new standards that they found
useful and simplify their programming work.

Cheers,
Daniel

-- 
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda




More information about the sr-dev mailing list