[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] MiNTlibs for PureC



Helmut_Karlowski@mausd.gun.de writes:

|> Hallo Guido,
|> 
|> GF>structure, a smart compiler should actually know from the declaration
|> 
|> But the constants are stored seperately, like strings. The
|> standard-C-compiler isn't that smart. Ok: GNU is (hopefully) ;-)
|> 
|> GF>which types the constants have. You ANSI C experts out there: What does
|> GF>the standard say?
|> 
|> Constants are by default 'int' :-)

Except when they aren't.  If the value fits in int then it's int.
Otherwise it will be unsigned int if it fits, or long if it fits (only if
LONG_MAX > UINT_MAX), or unsigned long otherwise.  (The actual rule is a
bit more complicated.)  The type of the containing declaration does *not*
matter.

But in any way is the compiler allowed to emit any warning it likes, as
long as it translates conforming code in a conforming way.

Andreas.

-- 
Andreas Schwab                                  "And now for something
schwab@suse.de                                   completely different."
SuSE GmbH, Schanzäckerstr. 10, D-90443 Nürnberg