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


Groups > comp.lang.c > #161066

Re: Representation of _Bool

From Philipp Klaus Krause <pkk@spth.de>
Newsgroups comp.lang.c
Subject Re: Representation of _Bool
Date 2021-05-25 11:40 +0200
Message-ID <s8igmt$p2f$1@solani.org> (permalink)
References <87tums515a.fsf@nosuchdomain.example.com> <86bl90dyxs.fsf@linuxsc.com> <87eedv50yb.fsf@nosuchdomain.example.com>

Show all headers | View raw


Am 24.05.21 um 22:30 schrieb Keith Thompson:
> I'll spend some time later looking into the question of trap
> representations.
> 

AFAIK, for some  compilers _Bool has trap representations, i.e. if you
(e.g. via memcpy) put a value other than false or true into a bool, you
get undefined behaviour when reading that value: On architectures where
it is faster, a jumptable might be used instead of a conditional jump
for an if/else construct. Or the code genration for a switch (a + b + c
+ d) will assume that the possible range is 0 to 4 if a to d are bool,
and generate a jump table just covering that range.

Philipp

Back to comp.lang.c | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Representation of _Bool Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-05-23 19:14 -0700
  Re: Representation of _Bool Philipp Klaus Krause <pkk@spth.de> - 2021-05-25 11:40 +0200
  Re: Representation of _Bool Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-05-24 12:11 +0100
    Re: Representation of _Bool Richard Damon <Richard@Damon-Family.org> - 2021-05-24 07:43 -0400
      Re: Representation of _Bool Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-05-24 17:27 +0100
      Re: Representation of _Bool Vir Campestris <vir.campestris@invalid.invalid> - 2021-05-25 21:20 +0100
    Re: Representation of _Bool Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-05-24 13:15 -0700
  Re: Representation of _Bool Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-05-24 06:49 -0700
    Re: Representation of _Bool Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-05-24 13:30 -0700
  Re: Representation of _Bool jacobnavia <jacob@jacob.remcomp.fr> - 2021-05-24 18:40 +0200
    Re: Representation of _Bool David Brown <david.brown@hesbynett.no> - 2021-05-24 18:55 +0200
    Re: Representation of _Bool Bart <bc@freeuk.com> - 2021-05-24 18:31 +0100

csiph-web