Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
boolean conditions
#6
In c, an rvalue is not necessarily a boolean, since boolean True equates to 1, and False equates to 0.
This is important when dealing with mixed C and assembler, because a 'short' (8 bit) 4 = 0000 0100, and if passed to the assembler
will be construed as False if used in the context of a boolean. You can use what C calls 'integral promotions' to create a boolean True from the 4 by assuring that bit zero is set to one.

assume variable z = 4 then z = ! ! z would become 0000 0001 which is now boolean True. and if it started as 0 would remain so, and would satisfy boolean False.

Been a while since I thought C or assembler so hope this makes sense.
Reply


Messages In This Thread
boolean conditions - by metulburr - Nov-30-2018, 12:23 AM
RE: boolean conditions - by micseydel - Nov-30-2018, 01:34 AM
RE: boolean conditions - by Gribouillis - Nov-30-2018, 07:33 AM
RE: boolean conditions - by wavic - Nov-30-2018, 09:23 AM
RE: boolean conditions - by Gribouillis - Nov-30-2018, 10:11 AM
RE: boolean conditions - by metulburr - Nov-30-2018, 03:08 PM
RE: boolean conditions - by Larz60+ - Nov-30-2018, 10:43 AM
RE: boolean conditions - by ichabod801 - Nov-30-2018, 03:37 PM
RE: boolean conditions - by nilamo - Nov-30-2018, 04:17 PM
RE: boolean conditions - by ichabod801 - Nov-30-2018, 04:47 PM
RE: boolean conditions - by Gribouillis - Nov-30-2018, 05:05 PM
RE: boolean conditions - by micseydel - Nov-30-2018, 07:29 PM
RE: boolean conditions - by ichabod801 - Nov-30-2018, 08:02 PM
RE: boolean conditions - by Gribouillis - Nov-30-2018, 08:16 PM
RE: boolean conditions - by wavic - Nov-30-2018, 09:01 PM
RE: boolean conditions - by Gribouillis - Nov-30-2018, 10:47 PM
RE: boolean conditions - by rootpl - Jan-06-2019, 01:10 PM
RE: boolean conditions - by nilamo - Jan-07-2019, 04:01 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020