Re: how to make it work

Liste des GroupesRevenir à l c 
Sujet : Re: how to make it work
De : fir (at) *nospam* grunge.pl (fir)
Groupes : comp.lang.c
Date : 29. Aug 2024, 20:24:57
Autres entêtes
Organisation : i2pn2 (i2pn.org)
Message-ID : <9964de3764c5a3fa1a85f64738f7028ecf8bea2a@i2pn2.org>
References : 1 2 3 4
User-Agent : Mozilla/5.0 (Windows NT 5.1; rv:27.0) Gecko/20100101 Firefox/27.0 SeaMonkey/2.24
James Kuyper wrote:
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.
>
very bad but at least clear
hovever as c standard rules/statements or how to call it are
dome to make c have sense then this rule should be changed
to this
An integer character constant mau have any integer type from simple types
avalieble (it is char, short, int long etc) - the value for it is like
adequate string ofd such walue would have in ram say 'lalalala" would heve
walule of 0x6c616c616c616c61

Date Sujet#  Auteur
29 Aug 24 * how to make it work12fir
29 Aug 24 +* Re: how to make it work6Ben Bacarisse
29 Aug 24 i`* Re: how to make it work5fir
29 Aug 24 i +* Re: how to make it work2Ben Bacarisse
29 Aug 24 i i`- Re: how to make it work1fir
29 Aug 24 i `* Re: how to make it work2James Kuyper
29 Aug 24 i  `- Re: how to make it work1fir
29 Aug 24 +* Re: how to make it work2Kaz Kylheku
29 Aug 24 i`- Re: how to make it work1fir
29 Aug 24 `* Re: how to make it work3Bonita Montero
29 Aug 24  `* Re: how to make it work2fir
31 Aug 24   `- Re: how to make it work1Bonita Montero

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal