Yesterday support for _Bool (and via stdbool.h bool) has been added to
the Z80 port.
This is the most complete support for bool in any sdcc port for now.
bool should work just like the standard requires, including support for
arrays of bool and using bool inside a struct.

Support for _Bool/bool is enabled when compiling using --std-c99 or
--std-sdcc99.

Developers that have been using another type of variable (e.g. unsigned
char) for condition variables are encouraged to try the new bool.

sdcc can generate faster, more compact code when using bool (e.g.
negation is implemented as a simple xor with 1).

Another example: Conditional jumps

if(x) for x of type unsigned char:

xor     a,a
or      a,4 (ix)
jr      Z,somewhere

if(x) for x of type bool:

bit     0,4 (ix)
jr      Z,somewhere

Should you encounter cases where using bool increases code size please
post sample code to the list or open a feature request with sample code.

Philipp

------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to