Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 31 Jul 2017 11:46:23 +0200
From: Jens Gustedt <jens.gustedt@...ia.fr>
Cc: musl@...ts.openwall.com, Michael Clark <michaeljclark@....com>
Subject: Re: stdbool.h does not define _Bool when included by C++
 code

Hello,

On Mon, 31 Jul 2017 11:18:28 +0200 Szabolcs Nagy <nsz@...t70.net> wrote:

> iow, this is either a minor gcc bug or a big fat c++ defect
> depending on how you look at it, the libc cannot fix this
> properly, just emulate the broken nonsense in gcc stdbool.h
> that nobody should rely on.

Basically stdbool.h is already a header to accomodate C++ usage of
bool, false and true to C. I makes not much sense to include this
in C++ code.

I think that applications that want to be shure that their code
compiles for both should use "bool" and should do

#ifndef __cplusplus
# include <stdbool.h>
#endif

We can put more comfort into this by lifting this #ifndef/#endif stuff
to the contents of the file, if people really want this. But code that
relies on this would not be guaranteed to be portable.

Using "bool" by means of the header is the intended usage, these
attrocities such as _Bool, _Noreturn etc are only there for backwards
compatibility. Hopefully at least some of them will be phased out in
the future.

I think we should not encourage the usage of these keywords in
application code unless this is needed for backwards compatibility,
nor should we try to impose their possible usage into other languages.

Jens

-- 
:: INRIA Nancy Grand Est ::: Camus ::::::: ICube/ICPS :::
:: ::::::::::::::: office Strasbourg : +33 368854536   ::
:: :::::::::::::::::::::: 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.