> 
> Yes, I guess that int would probably be a good choice for API and
> internal variables. Maybe bool or char could be used as member
> variables in classes, if memory usage is a concern (if we assume
> that there is no padding between member variables...).

Well, I hope the compiler would pick a "native" type for "bool" that was
as efficient as possible, whereas "char" will often be implemented as
the closest native type to "int8".

Whether that is "smaller" or "faster" than, say, "int32" varies with
host CPU and oftentimes with compiler settings.
On ARM for example, a "char" will often be allocated the same storage as
an "int" (since most ARM cores can't handle misaligned reads) but
requires additional CPU cycles to ensure that only 8 bits are used.
So using "int" takes the same memory but runs faster...
I think (can't remember offhand) that the compiler can be told to pack
"char" types, but that is always going to be slower.
Though probably not enough that we actually care in the grand scheme of
things, though!



> Conclusion: It is okay to _use_ bool, but we should avoid it in
> public API's in FLTK 1.3 (exceptions are possible). We should not
> change the API's in FLTK 1.3, but maybe in a later version...
> 
> Is this okay/acceptable?

Yes, I'd say so; for now, if the API is unchanged using bool internally
should not matter.



SELEX Galileo Ltd
Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14 
3EL
A company registered in England & Wales.  Company no. 02426132
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************

_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to