罗勇刚, 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) ) 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 ::