Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 31 May 2023 14:58:52 +0200
From: Joakim Sindholt <opensource@...sha.com>
To: musl@...ts.openwall.com
Subject: Re: [C23 divers headers 09/17] C23: update stdbool.h

On Wed, 31 May 2023 11:22:56 +0200, Jens Gustedt <Jens.Gustedt@...ia.fr> wrote:
> C23 has false, true and bool as keywords, so this file is basically
> not needed for modern applications. It is only provided for backwards
> compatibility. Implementations may also provide macros in addition to
> the keywords, so we do that because some user code may rely on these.
> ---
>  include/stdbool.h | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/include/stdbool.h b/include/stdbool.h
> index a9d7ab78..d9df7524 100644
> --- a/include/stdbool.h
> +++ b/include/stdbool.h
> @@ -1,11 +1,17 @@
> -#ifndef _STDBOOL_H
> -#define _STDBOOL_H
> +#ifndef __STDC_VERSION_STDBOOL_H__
> +#define __STDC_VERSION_STDBOOL_H__ 202311L
>  
>  #ifndef __cplusplus
>  
> +#if __STDC_VERSION__ >= 202311L
> +#define true true
> +#define false false
> +#define bool bool
> +#else

Why is this not simply
> +#if __STDC_VERSION__ < 202311L
>  #define true 1
>  #define false 0
>  #define bool _Bool
> +#endif

I can't find anything in C23 that says we need to re#define these keywords.

>  
>  #endif
>  
> -- 
> 2.34.1

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.