[gambit-list] Re: C interface: wrong types generated?

Bradley Lucier lucier at math.purdue.edu
Tue Dec 27 16:09:56 EST 2005


I'm not a C language lawyer, but I understand the issue as follows.

"char" and "signed char" are distinct types even if they have the  
same ranges (as they do on tjay and my systems).  "char" must behave  
either like "signed char" or "unsigned char" on any given system, but  
char, "signed char", and "unsigned char" are three distinct types.

On my system SCHAR_MAX and CHAR_MAX are both 127

Brad

On Dec 27, 2005, at 4:01 PM, Adam Langley wrote:

> On 12/27/05, Bradley Lucier <lucier at math.purdue.edu> wrote:
>> The problem seems to be in these lines in gambit.h:
>>
>> #if CHAR_MAX == SCHAR_MAX
>> #define ___SCHAR char
>> #else
>> #define ___SCHAR signed char
>> #endif
>>
>> I don't know why Marc thinks he needs these lines; I replaced them  
>> with
>>
>> #define ___SCHAR signed char
>
> Since defining ___SCHAR as "signed char" fixes things, that suggests
> that it was defined as "char" before. In turn that means that CHAR_MAX
> was not equal to SCHAR_MAX. While possible, that's a very odd setup.
> Can you create a file which contains the following:
>
> #include <limit.h>
>
> static const a = CHAR_MAX;
> static const b = SCHAR_MAX;
>
> and run 'gcc -E <filename>.c'? The last two lines should give the
> values of CHAR_MAX and SCHAR_MAX for your system. Generally I would
> expect them both to be 127.
>
>
> AGL
>
> --
> Adam Langley                                       
> agl at imperialviolet.org
> http://www.imperialviolet.org                       650-283-9641




More information about the Gambit-list mailing list