On Sat, Jan 8, 2022 at 6:29 AM Petro Karashchenko <
petro.karashche...@gmail.com> wrote:

> Hello team,
>
> Recently I mr. @Xiang Xiao <xiaoxiang781...@gmail.com> had a discussion
> in one of the PR's related to C89 code compliance. Particularly related to
> initializing a structure by field names (designated initializers). Mr. @Xiang
> Xiao <xiaoxiang781...@gmail.com> pointed out that "for the common code it
> is better to avoid C99 only features".
> I examined the current NuttX code and see that currently common code is
> far away from C89 already and things like "<stdbool.h>", "<inttypes.h>",
> "snprintf", "designated initializers", "__VA_ARGS__" (variadic macro) are
> deeply embedded into the code.
>
>
We need separate the features that come from the compiler and the standard
library. Since the libc is provided by NuttX self:

   1. The header files(e.g.stdbool.h, intttyes.h) and function(e.g.
   snprintf) can be used in common code since NuttX can provide the
   implementation for all arch even the arch use a very old compiler
   2. The preprocessor (e.g.  __VA_ARGS__) or language( designated
   initializers) feature need to avoid or incorporate into the conditional
   macro

.

> I would like to come up with the suggestion to make C99 as a prerequisite
> for the compiler that is used to build NuttX code.
>

As Greg said, if compilers used on all arch supported by NuttX support C99,
there is no reason to limit us to C89. The compiler status is a keypoint.


>
> Best regards,
> Petro
>
>

Reply via email to