Re: how to make it work

Liste des GroupesRevenir à l c 
Sujet : Re: how to make it work
De : jameskuyper (at) *nospam* alumni.caltech.edu (James Kuyper)
Groupes : comp.lang.c
Date : 29. Aug 2024, 20: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.

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