Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #7920

Re: Implicit convervsion of bool to int: why?

From "MikeP" <mp011011@some.org>
Newsgroups comp.lang.c++
Subject Re: Implicit convervsion of bool to int: why?
Date 2011-07-17 05:38 -0500
Organization A noiseless patient Spider
Message-ID <ivue3d$fp4$2@dont-email.me> (permalink)
References <ivrll6$jh0$1@dont-email.me> <ael4275glbj0abvp20jbrm9qivttojbnv8@4ax.com> <ivtqc2$ics$1@dont-email.me> <6925275v11gq2ejs6icqjurcq3i93k9tkb@4ax.com>

Show all headers | View raw


Robert Wessel wrote:
> On Sun, 17 Jul 2011 00:02:02 -0500, "MikeP" <mp011011@some.org> wrote:
>
>> Robert Wessel wrote:
>>> On Sat, 16 Jul 2011 04:29:14 -0500, "MikeP" <mp011011@some.org>
>>> wrote:
>>>
>>>> Why can bool types be implicitly converted to ints? Wouldn't it be
>>>> better if a bool was a bool was a bool was a bool...? The
>>>> complementary question is also a curiosity: why can an int be
>>>> converted to a bool? I think the answer to the last question has to
>>>> do with "trueness" in C++ historically meaning "not zero" instead
>>>> of meaning "one".
>>>
>>>
>>> Why can shorts be implicitly converted to ints?  Or ints to longs?
>>> Or floats to doubles?  Or...?
>>
>> Because the are numeric? (Now what do you think?).
>
>
> I think from a C perspective, bools are very close to numerics.  You
> may think otherwise.

I hate you. 

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Implicit convervsion of bool to int: why? "MikeP" <mp011011@some.org> - 2011-07-16 04:29 -0500
  Re: Implicit convervsion of bool to int: why? Krice <paulkp@mbnet.fi> - 2011-07-16 02:37 -0700
    Re: Implicit convervsion of bool to int: why? "MikeP" <mp011011@some.org> - 2011-07-16 04:43 -0500
      Re: Implicit convervsion of bool to int: why? BGB <cr88192@hotmail.com> - 2011-07-16 02:54 -0700
        Re: Implicit convervsion of bool to int: why? Abhishek Padmanabh <abhishek.padmanabh@gmail.com> - 2011-07-16 18:52 +0100
          Re: Implicit convervsion of bool to int: why? BGB <cr88192@hotmail.com> - 2011-07-16 23:03 -0700
            Re: Implicit convervsion of bool to int: why? Abhishek Padmanabh <abhishek.padmanabh@gmail.com> - 2011-07-17 09:02 +0100
              Re: Implicit convervsion of bool to int: why? BGB <cr88192@hotmail.com> - 2011-07-17 02:04 -0700
  Re: Implicit convervsion of bool to int: why? Robert Wessel <robertwessel2@yahoo.com> - 2011-07-16 22:28 -0500
    Re: Implicit convervsion of bool to int: why? "MikeP" <mp011011@some.org> - 2011-07-17 00:02 -0500
      Re: Implicit convervsion of bool to int: why? Robert Wessel <robertwessel2@yahoo.com> - 2011-07-17 02:04 -0500
        Re: Implicit convervsion of bool to int: why? "MikeP" <mp011011@some.org> - 2011-07-17 05:38 -0500
        Re: Implicit convervsion of bool to int: why? "MikeP" <mp011011@some.org> - 2011-07-20 05:14 -0500
      Re: Implicit convervsion of bool to int: why? Niklas Holsti <niklas.holsti@tidorum.invalid> - 2011-07-30 13:18 +0300
        Re: Implicit convervsion of bool to int: why? Niklas Holsti <niklas.holsti@tidorum.invalid> - 2011-07-31 13:48 +0300
  Re: Implicit convervsion of bool to int: why? James Kanze <james.kanze@gmail.com> - 2011-07-20 11:08 -0700

csiph-web