OT: Requesting C advice

Mike McCarty Mike.McCarty at sbcglobal.net
Fri May 25 20:20:15 UTC 2007


Michael Hennebry wrote:
> On Thu, 24 May 2007, Mike McCarty wrote:
> 
> 
>>Matthew Saltzman wrote:
>>
>>>On Thu, 24 May 2007, Mike McCarty wrote:
>>>
>>
>>[snip]
>>
>>
>>>>>developed.  In any case, I don't know of any modern machine that
>>>>>doesn't represent negative integers in two's complement.
>>>>
>>>>
>>>>Reach into your pocket, and pull out your calculator.
>>>
>>>
>>>Fair enough.  I'll concede the point if you can name a
>>>standard-conforming C compiler for my calculator.
> 
> 
> The calculator was probably programmed with a cros-compiler.
> It wouldn't surprise me if the compiler derived from gcc.
> The calculator's processor probably doesn't use decimal natively.

Umm, the one's whose internals I know about use decimal
natively. I don't know of a machine which uses a real
compiler. The very early ones used hardware.

> If it does use decimal natively,
> one could still write a comforming compiler for it.
> Doing so might be more interesting than one would like.

That was my comment, since the representations for integral
types are guaranteed to be pure binary.

>>The Standard does not say what size a byte is. CHAR_BIT defines that.
>>It is possible for a conforming implementation to have CHAR_BIT to
>>be 64. A byte does not have to be the smallest independently addressable
>>unit greater than a bit on the underlying architecture, but it does have
>>to be the smallest unit to which the implementation provides
>>addressability which is greater than a bit.
> 
> 
> I want to emphasize: *the implementation* .
> 
> The implementation could have CHAR_BITS=13 or 67 on pretty
> much any given machine, not sensibly, but it could.

Addressability would be very difficult. Just loading an
integer would require masks and shifts on modern machines,
or extreme wastage of memory space.

> Another poster mentioned a compiler that
> had char size as a compiler-time option.
> The implementation could provide CHAR_BITS=13 and CHAR_BITS=67.

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