|
Message-ID: <20221123091109.36e2bdf2@inria.fr>
Date: Wed, 23 Nov 2022 09:11:09 +0100
From: Jₑₙₛ Gustedt <jens.gustedt@...ia.fr>
To: "罗勇刚(Yonggang Luo)" <luoyonggang@...il.com>
Cc: musl@...ts.openwall.com, Reini Urban <reini.urban@...il.com>
Subject: Re: C23 implications for C libraries
罗勇刚,
there might be a misunderstanding here, this page is not meant for
musl alone and the example code is just that, example code. How C
library implementations then do it is clearly a question of their
particular coding style.
on Wed, 23 Nov 2022 12:31:27 +0800 you (罗勇刚(Yonggang Luo)
<luoyonggang@...il.com>) wrote:
> I have concern about the macros guard with __cplusplus and
> __STDC_VERSION__
>
> #if (__cplusplus >= 201103L) || (__STDC_VERSION__ >= 202311L)
> #define NULL nullptr
> #elif defined(__cplusplus)
> #define NULL 0L /* Any of 0, 0L, 0LL as wide as a void*
> */ #else
> #define NULL ((void*)0)
> #endif
>
>
> I think all of these should be guarded with
> #if (defined(__cplusplus) && (__cplusplus >= 201103L)) ||
> (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 202311L))
>
> this is safer to avoid -Wundef complain it
IIRC musl's strategy has so far been to use the implicit 0 rule for
identifiers in preprocessor conditionals. But I may be mistaken.
Also, `__STDC_VERSION__` has been introduced in C95, I think, do we
even support compilers that don't have this?
Thanks
Jₑₙₛ
--
:: INRIA Nancy Grand Est ::: Camus ::::::: ICube/ICPS :::
:: :::::::::::::::::::::: gsm France : +33 651400183 ::
:: ::::::::::::::: gsm international : +49 15737185122 ::
:: http://icube-icps.unistra.fr/index.php/Jens_Gustedt ::
Content of type "application/pgp-signature" skipped
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.