about gcc compiler option

Charles Curley charlescurley at charlescurley.com
Mon Nov 28 05:43:31 MST 2005


On Mon, Nov 28, 2005 at 06:05:00AM +0000, Jason Holt wrote:
> 
> On Mon, 28 Nov 2005, Laurent R wrote:
> 
> >I used gcc version 3.3.2;
> >How can I change the 'bool' variable from 4 byte (default value) to 1 
> >byte. I used the '-mone-byte-bool', but this gcc of version 3.3.2 does not 
> >recogize this option.
> 
> This seems to work:
> 
> 
> #include <stdio.h>
> 
> typedef char bool;
> main() {
>         bool foo=1;
>         printf("Foo! %d (%d)\n", foo, sizeof(foo));
> }
> 
> [jason at erg] ~$ gcc foo.c
> [jason at erg] ~$ ./a.out
> Foo! 1 (1)

sizeof (foo) is not necessarily the same as the amount of space
required by foo. Processors that require alignment on word boundaries
(e.g. PDP-11, 68000) may force padding.

-- 

Charles Curley                  /"\    ASCII Ribbon Campaign
Looking for fine software       \ /    Respect for open standards
and/or writing?                  X     No HTML/RTF in email
http://www.charlescurley.com    / \    No M$ Word docs in email

Key fingerprint = CE5C 6645 A45A 64E4 94C0  809C FFF6 4C48 4ECD DFDB
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://plug.org/pipermail/plug/attachments/20051128/d3c9fa9c/attachment.bin 


More information about the PLUG mailing list