OT: Requesting C advice

Mike McCarty Mike.McCarty at sbcglobal.net
Thu May 24 11:53:17 UTC 2007


Mike McCarty wrote:
> Matthew Saltzman wrote:

[snip]

>>
>> sizeof(char) == 1 is guaranteed by the standard.  There's no reference 
>> to "bytes", but it is commonly accepted that the char type is a byte.  
> 
> 
> Erm, from the Standard:
> 
> 3.4
>        [#1] byte
>        addressable  unit  of  data storage large enough to hold any
>        member  of  the  basic  character  set  of   the   execution
>        environment

Also from the Standard:

3.5
        [#1] character
        bit representation that fits in a byte


6.5.3.4  The sizeof operator
...

[#2] The sizeof operator yields the size (in bytes)  of  its
        operand,  which  may  be  an expression or the parenthesized
        name of a type.  The size is determined from the type of the
        operand.   The  result  is  an  integer.  If the type of the
        operand is a variable length  array  type,  the  operand  is
        evaluated;  otherwise,  the operand is not evaluated and the
        result is an integer constant.

The word "byte" appears dozens of times in the Standard, not counting
its appearance in the word "multibyte".

Mike
-- 
p="p=%c%s%c;main(){printf(p,34,p,34);}";main(){printf(p,34,p,34);}
Oppose globalization and One World Governments like the UN.
This message made from 100% recycled bits.
You have found the bank of Larn.
I can explain it for you, but I can't understand it for you.
I speak only for myself, and I am unanimous in that!




More information about the fedora-list mailing list