[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Portability problem with SCM_DEBUG_TYPING_STRICTNESS=1
From: |
Dirk Herrmann |
Subject: |
Re: Portability problem with SCM_DEBUG_TYPING_STRICTNESS=1 |
Date: |
Fri, 8 Jun 2001 13:15:02 +0200 (MEST) |
On 8 Jun 2001, Matthias Koeppe wrote:
> > In this case, I think we should wait until scm_t_bits is made into an
> > unsigned type. Then, instead of writing 0xFFFUL we should probably write
> > (scm_t_bits) 0xFFF. Currently, as long as scm_t_bits is signed, this
> > wouldn't solve your problem.
>
> Yes it does solve the problem because the integer overflow happens at
> shift time, not at assignment time. 0xFFF << 20 has the 31st bit set,
> so it does not fit into a signed 32-bit integer. 0xFFFU << 20,
> however, is a nice unsigned 32-bit integer; assigning it to a
> scm_bits_t location does not cause an error or warning, whether
> scm_bits_t is unsigned or not.
Sorry for being unclear: Yes, your patch solves the problem (i. e. you
don't get warnings any more). But, I am not sure it is The Right
Thing. IMO, the cast to scm_t_bits would be The Right Thing, but this
will not help to get rid of the warnings yet.
Best regards,
Dirk Herrmann