Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Why _Bool was not defined as enum in C99? Date: Fri, 16 Sep 2016 10:47:36 -0700 Organization: None to speak of Lines: 28 Message-ID: References: <6b5aa241-0498-4e41-993b-a1ed445effb0@googlegroups.com> <35259377-cc66-489b-aa74-fb031c20ce29@googlegroups.com> <2a43ea82-8927-435f-9897-096948ddbc15@googlegroups.com> <2348118c-fe7e-4f48-afb5-b453a87c1650@googlegroups.com> <87k2eckvu2.fsf@bsb.me.uk> <30349ef9-c5ba-44de-9a98-da50e16ae517@googlegroups.com> <878tuskqde.fsf@bsb.me.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="945944de09706c9b4e29b53c9d2efdc2"; logging-data="21318"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/rbmrB+dXHDneBlCgpM2KW" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:z8A3UgxujhNq5g5uI0EqUnfm/Ek= sha1:OL40RUuprLqTBw3jqGN6vkiQE9A= Xref: csiph.com comp.lang.c:93630 Melzzzzz writes: > On 2016-09-16, Ben Bacarisse wrote: >> Thiago Adams writes: >> >>> I found some explanation about bool in C++. >>> The book, "The design and evolution of C++", pag 254-255. >>> >>> "Naturally, the first idea was to define an enum. However, and >>> examination of hundreds of thousand of lines ..reveled that most >>> boolean types were used in ways that require free conversion from and >>> to int" >> >> Thanks for that, but it can't be the main reason C chose not to use an >> enum since, as I am sure you know, C has always permitted those >> conversions, whist C++ decided to forbid them (without a cast -- that's >> the "free conversion" part). > > Hm, I am pretty sure that one can convert bool from/to int without cast in > C++... Of course -- because C++'s bool is not an enum. That's exactly *why* C++'s bool is not an enum. -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"