Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: type sizes in C (was: Java versus C Speed Comparison)

Author: Matt Taylor

Date: 17:19:52 01/11/03

Go up one level in this thread


On January 11, 2003 at 18:54:00, Miguel A. Ballicora wrote:

>On January 11, 2003 at 17:29:28, Heiner Marxen wrote:
>
>>On January 10, 2003 at 21:34:38, Robert Hyatt wrote:
>>
>>>On January 10, 2003 at 18:14:09, Miguel A. Ballicora wrote:
>>[...]
>>>>If you want portable code, use long long for both. If it is a very important
>>>>variable use typedef.
>>
>>That often is not a good solution.  Memory is not exactly for free,
>>especially not so in the caches.
>>Also (long long) is not exactly portable, either.
>
>I think that you mean "using long long" is not a good solution, rather than
>using typedefs. Memory is not free, I agree, that is whay I say that for an
>important variable (that could be later an arrayf of them) it is better to use a
>typedef. For local variables I do not think that it will really matters in most
>of the cases.
>
>If it is really needed an int16_t, int32_t, int64_t that could be defined as a
>typedef. That should require a minimum maintance. My point is that it is not a
>big deal that the language provide that when I could do it by myself.

It is a big deal when you port code that relies on bitfields and other
size-specific behaviors.

Heiner's solution is nice, but I see no reason why this shouldn't be addressed
in the C spec. Furthermore it only works in some cases. It does not work when
you need a type of specific length that is not supported natively by the
architecture. It still does not support 128-bit integers on x86 or Alpha.

-Matt



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.