Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Outputting u64 word using printf?

Author: Heiner Marxen

Date: 08:15:19 06/07/04

Go up one level in this thread


On June 07, 2004 at 11:08:08, Uri Blass wrote:

>On June 07, 2004 at 11:01:51, Ricardo Gibert wrote:
>
>>On June 07, 2004 at 10:46:28, Uri Blass wrote:
>>
>>>On June 07, 2004 at 10:40:09, Fabien Letouzey wrote:
>>>
>>>>On June 07, 2004 at 10:36:58, Vincent Diepeveen wrote:
>>>>
>>>>>On June 07, 2004 at 10:30:50, Fabien Letouzey wrote:
>>>>
>>>>>r = 1<<36; // works for good compilers not for the rest
>>>>
>>>>Hm, my understanding is that first "1<<36" should be calculated (so it's 0 if
>>>>sizeof(int) <= 4) and *then* cast into r's type (oops, too late).
>>>>
>>>>Fabien.
>>>
>>>A smart compiler should understand that 1<<36 cannot mean 0 because in that case
>>>the programmer has no reason to write it in that way.
>>
>>Of course a programmer might have a reason to write it that way.
>
>He may write 1<<i when i may be 36 in part of the cases but I see no reason to
>write 1<<36 and not 0.

Both, the "1" and the "36" may be the result of non-trivial macro expansion.
You do not seriously expect a compiler to handle "1<<36" differently when
written directly or expanded by the preprocessor, do you?

>Uri

Cheers,
Heiner



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.