Suggestions

Jonathan Coxhead jonathan at doves.demon.co.uk
Wed Apr 26 20:01:41 BST 2000


 | A data point using egcs 1.1.2 on my linux box:
 | 
 | gosford [~] % cat test.c
 | #ifndef __cplusplus
 | #include <stdbool.h>
 | #endif
 | #include <stdio.h>
 | 
 | int main(int argc, char **argv)
 | {
 |   printf("%d\n", sizeof(bool));
 | 
 |   return 0;
 | }
 | gosford [~] % gcc test.c
 | gosford [~] % ./a.out
 | 4
 | gosford [~] % g++ test.c
 | gosford [~] % ./a.out
 | 1

   Very useful---hard facts! Thank you.

   This is a platform-specific thing, so the answer for Linux doesn't 
tell us much about what we ned to know. If it's true for RISC O S as 
well, for me it carries the implication that no-one uses OSLib with 
C++. But I know they do, so it can't be. (Does that make sense?)

   If RISC O S C++ has |sizeof (bool) == 1|, we are stuck, as Ainsley 
says. But as long as it is 4, no problems, and no change necessary.

   But we would still be a hostage to fortune: if a new compiler came 
along, with a different definition of |bool|, we'd be stuck. We would 
have to use |osbool, ostrue, osfalse| (and also |osbits, osnone, 
osall|, for consistency) and define |bool| to be |osbool| except in 
C++, where we leave it alone.

   If G++ defines |sizeof (bool) == 4| (under RISC O S), I would 
advocate no change. If it doesn't, we have to do something, and I'm 
terminally confused :-)

        /|
 o o o (_|/
        /|
       (_/



More information about the oslib-user mailing list