From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H2 autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 21774 invoked from network); 23 Nov 2022 08:21:07 -0000 Received: from second.openwall.net (193.110.157.125) by inbox.vuxu.org with ESMTPUTF8; 23 Nov 2022 08:21:07 -0000 Received: (qmail 32448 invoked by uid 550); 23 Nov 2022 08:21:04 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 32412 invoked from network); 23 Nov 2022 08:21:03 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:reply-to:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=/Br98kt7jRTvLJQG6SGT4EEWr93Srvo71eGlKM+by/Y=; b=cwD79DwysB4IOfZ/ZCdSunO4+GL+mnhNYpJ6TZMa4fxFNpHMZUUPP9FgY/5EQQE44Q mB6lMep35m1juqwtg/jDUi6cIIV6PI9R5mnnsKshcmWrzYF6B/1Y0+R5k19zG9Ir032H 8JTuZ7MmVeaJgEgDdq8d6N67ykqYVH0MJyNzTnbQWs8toXkVbYd3oaU2yW/fr+NZpz+k mhgWIjfJXAPURfWTJmXmml8+z32WIDIDnsFTWH9rE5lHdSQ7Sc8g6SdXFri4cS4HbNXm ImaZoW3V5FEtLhZr9Y9j7fUhB/gAEYcmJNlZHU57i5vLUT3FRv1XvboUseHkhl/pNlaV AIUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:reply-to:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=/Br98kt7jRTvLJQG6SGT4EEWr93Srvo71eGlKM+by/Y=; b=udYGvNpKOpNzASofDZu8u5zXO4F5ObgL/u9/nFCQWGch1u2KplWgi+jIpAv4duuGwQ XoEJYz9f6j1MsyrisN7jeyR8pRiunfWVk7D+bAmimQUygxLD45fC1b1SEXx2CSQ5OhbP cBuAjHWQ7GxfQ7kEB83iAFseUINgdaChUSO1ZQB8bXw802GLeh8TvgL7cN8XKc7bw6Hi /2Tg5m11tCzvZakqFGFNnfR4A2Ltif7GE9Q7RLrgTsjlWHnOnwXMaD1MeEAxcqUjwKih gPQtsQ3fefe9R3+oWHcFSuFUFxGxlmYDMijeE/FgZq7gPhi2E2jzu1uNdSukp5iWPUDD BGfg== X-Gm-Message-State: ANoB5plQA72oft0XkfkkTUWpbgzuSfunrcGaRDQR2tlUZ0pw8GE0oN0G 6YBJUFcHbxNLrx+kp629aI4yI0wOShYB5drXyYY= X-Google-Smtp-Source: AA0mqf7skpusMEABpA6aBFAs2sqfcvOexCTNxyBwvV03ZwlTni5Z+8ChVtj9EBihiDbW5YTwF+G0VLktSCnkDYKSPY4= X-Received: by 2002:a67:f94c:0:b0:3af:183:698d with SMTP id u12-20020a67f94c000000b003af0183698dmr5871055vsq.7.1669191651712; Wed, 23 Nov 2022 00:20:51 -0800 (PST) MIME-Version: 1.0 References: <20220923162518.56284329@inria.fr> <20221121220625.39f595fb@inria.fr> <20221123091109.36e2bdf2@inria.fr> In-Reply-To: <20221123091109.36e2bdf2@inria.fr> From: =?UTF-8?B?572X5YuH5YiaKFlvbmdnYW5nIEx1byk=?= Date: Wed, 23 Nov 2022 16:20:39 +0800 Message-ID: To: =?UTF-8?B?SuKCkeKCmeKCmyBHdXN0ZWR0?= Cc: musl@lists.openwall.com, Reini Urban Content-Type: multipart/alternative; boundary="00000000000076640c05ee1ef700" Subject: Re: [musl] C23 implications for C libraries --00000000000076640c05ee1ef700 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Nov 23, 2022 at 4:11 PM J=E2=82=91=E2=82=99=E2=82=9B Gustedt wrote: > > =E7=BD=97=E5=8B=87=E5=88=9A, > 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 (=E7=BD=97=E5=8B=87=E5=88=9A(Yongg= ang Luo) > ) wrote: > > > I have concern about the macros guard with __cplusplus and > > __STDC_VERSION__ > > > > #if (__cplusplus >=3D 201103L) || (__STDC_VERSION__ >=3D 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 >=3D 201103L)) || > > (defined(__STDC_VERSION__) && (__STDC_VERSION__ >=3D 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=E2=82=91=E2=82=99=E2=82=9B > > -- > :: INRIA Nancy Grand Est ::: Camus ::::::: ICube/ICPS ::: > :: :::::::::::::::::::::: gsm France : +33 651400183 :: > :: ::::::::::::::: gsm international : +49 15737185122 :: > :: http://icube-icps.unistra.fr/index.php/Jens_Gustedt :: -- =E6=AD=A4=E8=87=B4 =E7=A4=BC =E7=BD=97=E5=8B=87=E5=88=9A Yours sincerely, Yonggang Luo --00000000000076640c05ee1ef700 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Wed, Nov 23, 2022 at 4:11 PM J=E2=82=91=E2=82= =99=E2=82=9B Gustedt <jens.gust= edt@inria.fr> wrote:
>
> =E7=BD=97=E5=8B=87=E5=88=9A,> 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
&= gt; particular coding style.
>
> on Wed, 23 Nov 2022 12:31:27 += 0800 you (=E7=BD=97=E5=8B=87=E5=88=9A(Yonggang Luo)
> <luoyonggang@gmail.com>) wrote:
>=
> > I have concern about the macros guard with __cplusplus and> > __STDC_VERSION__
> >
> > #if (__cplusplus >= =3D 201103L) || (__STDC_VERSION__ >=3D 202311L)
> > #define NUL= L nullptr
> > #elif defined(__cplusplus)
> > #define NULL= 0L =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* 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) &&a= mp; (__cplusplus >=3D 201103L)) ||
> > (defined(__STDC_VERSION_= _) && (__STDC_VERSION__ >=3D 202311L))
> >
> >= this is safer to avoid -Wundef complain it
>
> IIRC musl's= strategy has so far been to use the implicit 0 rule for
> identifier= s in preprocessor conditionals. But I may be mistaken.
>
> Also= , `__STDC_VERSION__` has been introduced in C95, I think, do we
> eve= n support compilers that don't have this?

It's not because t= he compiler, it's because:
* when compiling C code, __cplusplus is n= ot defined,
* when compiling C++ code, __STDC_VERSION__ is not defined
>
> Thanks
> J=E2=82=91=E2=82=99=E2=82=9B
>
&= gt; --
> :: INRIA Nancy Grand Est ::: Camus ::::::: ICube/ICPS :::> :: :::::::::::::::::::::: gsm France : +33 651400183 =C2=A0 ::
>= ; :: ::::::::::::::: gsm international : +49 15737185122 ::
> :: http://icube-ic= ps.unistra.fr/index.php/Jens_Gustedt ::



--
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0=E6=AD=A4=E8=87=B4
=E7=A4=BC
=E7=BD=97=E5=8B= =87=E5=88=9A
Yours
=C2=A0 =C2=A0 sincerely,
Yonggang Luo
--00000000000076640c05ee1ef700--