Damien Neil wrote:
> 
> On Wed, Dec 27, 2000 at 10:46:03AM -0500, Philip Newton wrote:
> > So a native int could be 8 bits big? I think that's allowed according to
> > ANSI.
> 
> ANSI/ISO C states:
>   char <= short <= int <= long
> 
>   char  >=  8 bits
>   short >= 16 bits
>   int   >= 16 bits
>   long  >= 32 bits

I don't recall the bit sizes to be in ANSI C.  Which paragraph is that
in?
Even so, the fact that a standard may declare it, doesn't make it true.
I would expect embedded targets to differ from this.

> C99 adds "long long", which is >= long, and is at least 64 bits large.
> 
> I'd be in favor of defining Perl's "native int" type to be at least
> 32 bits long.  I would recommend against using the compiler's default
> int type in all cases, as there are compilers which define int as 16
> bits for backwards compatability reasons.  (As opposed to 16 bits being
> the native word size of the architecture.)

That's eskewing efficiency to make sensible minimum guarantees.  I'd
personally rather see the C compiler's native types be used, because
that's what the platform can do _efficiently_.  Using larger types than
that harms perl's ability to perform well on small platforms.

Hildo

Reply via email to