Sujet : Re: how to make it work
De : jameskuyper (at) *nospam* alumni.caltech.edu (James Kuyper)
Groupes : comp.lang.cDate : 29. Aug 2024, 19:16:14
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vaqdte$2arg$1@dont-email.me>
References : 1 2 3
User-Agent : Mozilla Thunderbird
fir <
fir@grunge.pl> writes:
...
fir <fir@grunge.pl> writes:
>
see such code
>
>
long long unsigned tag ;
>
void foo(long long unsigned tag)
{
if(tag=='warsaw') printf("\nwarsaw");
if(tag=='paris') printf("\nparis");
if(tag=='new york') printf("\nnew york");
if(tag=='old york') printf("\nold york");
if(tag=='very old york') printf("\nvery old york");
...
- my example work on up to 4 lellets/digits/signs
but i dont know how to make it work for 8
"An integer character constant has type int. ... The
value of an integer character constant containing more than one
character, ... is implementation-defined."
The implementation you're using apparently defines a different value for
each possible combination of 4 characters, which is the maximum number
allowed if sizeof(int)==4. Keep in mind that, since the mapping is
implementation-defined, such code is non-portable. For instance, it's
entirely possible that an implementation sets the value of a
multi-character constant solely by looking at it's first or last
characters. On some implementation, you might have 'new york' == 'k' and
'old york' == 'k'.
as even old c has 64 bit unsigned i guess it should work, but dont know how
to make it work
So, by "old c" you mean C99? Before C99, no integer type was guaranteed
to have more than 32 bits.