Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 23 Nov 2022 16:20:39 +0800
From: 罗勇刚(Yonggang Luo) <luoyonggang@...il.com>
To: Jₑₙₛ Gustedt <jens.gustedt@...ia.fr>
Cc: musl@...ts.openwall.com, Reini Urban <reini.urban@...il.com>
Subject: Re: C23 implications for C libraries

On Wed, Nov 23, 2022 at 4:11 PM Jₑₙₛ Gustedt <jens.gustedt@...ia.fr> wrote:
>
> 罗勇刚,
> 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?

It's not because the compiler, it's because:
* when compiling C code, __cplusplus is not defined,
* when compiling C++ code, __STDC_VERSION__ is not defined

>
> 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 ::



--
         此致
礼
罗勇刚
Yours
    sincerely,
Yonggang Luo

Content of type "text/html" 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.