Date: Tue, 28 Oct 1997 10:42:02 +0200 (IST) From: Eli Zaretskii To: Georg Kolling cc: nuser AT rsuzi DOT pgu DOT karelia DOT ru, djgpp AT delorie DOT com Subject: Re: [Q]: unsigned char In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On Mon, 27 Oct 1997, Georg Kolling wrote: > Using exactly this code, the compiler should give you the warning > "multi-character character constant" because of "'\xFD'". > '\xFD' represented as a number is 796411460, which can never be represented > with an unsigned char. I think you are wrong. 'c' constants are not character constants, they are ints. You can verify it with a simple test program I attach at the end of this message. It prints 4 for the sizeof of all the constants, which means they are ints. That is why GCC doesn't say anything about multi-character constants. > > When I use signed char a, the warning > > disappears > > Very strange... If you adopt the view of '\xFD' as an int, it's not strange at all. ----------------------- a test program ----------------------------- #include int main (void) { size_t s1 = sizeof ('c'); size_t s2 = sizeof (0xFD); size_t s3 = sizeof ('\xFD'); printf ("size of 'c' is %ld; size of %u is %ld; size of %u is %ld\n", s1, 0xFD, s2, '\xFD', s3); return 0; }