POV-Ray : Newsgroups : povray.off-topic : Mysteries of the universe : Re: Mysteries of the universe Server Time
6 Sep 2024 05:17:00 EDT (-0400)
  Re: Mysteries of the universe  
From: Darren New
Date: 4 Sep 2009 11:46:16
Message: <4aa13648$1@news.povray.org>
clipka wrote:
> Invisible schrieb:
>> Indeed. Considering that C is supposedly *the* language for writing 
>> low-level code, I find it quite surprising that it provides absolutely 
>> no way to select a binary number of a specific size.
> 
> That's actually its strength... 

Huh? How do you come up with that as a strength?

I would far rather say "I want an integer with a range of 0 to 1,000,000" 
than try to find the project-specific typedef du jour that says the same thing.

> Not commonly known, C99 also specifies that <stdint.h> shall contain 
> typedefs for various integers to be used in case a particular size is 
> desired:
> 
> - intN_t / uintN_t (e.g. int8_t) for exact size:

Yeah, works great until you use a compiler that doesn't support it, or a 
project written to work on a compiler that doesn't assume you have support 
for it. Then you have to pick out each typedef one at a time, because C only 
took 30 years to decide on how to name an integer in a portable way.

>> It doesn't even seem to provide a vague suggestion of what size you're 
>> going to get; it's just random pot luck with each compiler you try...
> 
> Oh yes, it does: <types.h> gives you all you need to know about your 
> int, short, long etc.

Except that's the utterly wrong bass-ackwards way to do it. I don't want you 
to tell me what sizes I'm allowed to use, and then have me write code to 
instruct the compiler as to which I want. I want to tell you what my program 
requires and have the compiler generate the f'ing code it needs to.

I am just glad that given the PDP-8 was segmented we didn't wind up with two 
different kinds of "while" statement: one with a body that fit in a short 
jump and one with a body that fit in the range of a long jump, along with a 
header file telling us how many bytes can fit in a short jump.

-- 
   Darren New, San Diego CA, USA (PST)
   I ordered stamps from Zazzle that read "Place Stamp Here".


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.