Suggestions
David Bryan
D.J.Bryan at cranfield.ac.uk
Wed Apr 26 22:00:17 BST 2000
In message <200004261901.MAA29169 at purple.trimedia.sv.sc.philips.com>
"Jonathan Coxhead" <jonathan at doves.demon.co.uk> wrote:
> 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 :-)
Well, given the source file from Tom Hughes, ie
#ifndef __cplusplus
#include <stdbool.h>
#endif
#include <stdio.h>
int main(int argc, char **argv)
{
printf("%d\n", sizeof(bool));
return 0;
}
Compiling on RISC OS with gcc 2.95.2 gives
ADFS::Primary.$.Public* gcc test.c
ADFS::Primary.$.Public* !RunImage
4
ADFS::Primary.$.Public* g++ test.c
ADFS::Primary.$.Public* !RunImage
1
I suspect that people have got away with it for so long because
bool doesn't appear in many structs. One rare example is with
drawfile_options, in the file drawfile.h. For the file
#include <stdio.h>
#ifdef __GNUG__
#define bool dummy
#include "types.h"
#undef bool
#endif
#include "drawfile.h"
int main()
{
printf("%d\n", sizeof(drawfile_options));
return 0;
}
Using c++ gives 76, but using g++ gives only 60. So, as Jonathan
says, we (you) have to do something.
--
David Bryan
More information about the oslib-user
mailing list