Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Compiler bug?

Author: Dieter Buerssner

Date: 16:04:19 07/04/02

Go up one level in this thread


On July 04, 2002 at 04:14:00, Sune Fischer wrote:

>I'm curious, is 0xff then used as an 4 byte integer and not as a char?

Your question cannot be answered for Standard C - it can only be answered for
specific implementations. Also, I think, in most cases, the answer will not be
needed anyway.

A hexadecimal constant without a suffix has type int, if the value fits in this
type. If it doesnt't fit into type int, the next type in the sequence unsigned
int, long, unsigned long, long long, unsigned long long is used. Same for octal
constants. For decimal constants, the sequence is int, long, long long (no
unsigned). Different compilers/architectures can (and will) use different
amounts of bytes for type int (including only one byte int the sense of the
C-Standard. Note that the C-Standard allows bytes of say 32 bits, and I think
there are even some implementations on embedded processors, that use this). 0xff
will allways fit into type int, so the type of 0xff is guaranteed to be int.

Regards,
Dieter




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.