Deutsch English Français Italiano |
<9964de3764c5a3fa1a85f64738f7028ecf8bea2a@i2pn2.org> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!weretis.net!feeder9.news.weretis.net!i2pn.org!i2pn2.org!.POSTED!not-for-mail From: fir <fir@grunge.pl> Newsgroups: comp.lang.c Subject: Re: how to make it work Date: Thu, 29 Aug 2024 20:24:57 +0200 Organization: i2pn2 (i2pn.org) Message-ID: <9964de3764c5a3fa1a85f64738f7028ecf8bea2a@i2pn2.org> References: <877194bd8a95b9acb03db317ee000e94cce2834d@i2pn2.org> <87cylrwkdf.fsf@bsb.me.uk> <be85fd1fb842b5dc7851d36d535869973cc325cf@i2pn2.org> <vaqdte$2arg$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Thu, 29 Aug 2024 18:25:02 -0000 (UTC) Injection-Info: i2pn2.org; logging-data="170811"; mail-complaints-to="usenet@i2pn2.org"; posting-account="+ydHcGjgSeBt3Wz3WTfKefUptpAWaXduqfw5xdfsuS0"; User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:27.0) Gecko/20100101 Firefox/27.0 SeaMonkey/2.24 In-Reply-To: <vaqdte$2arg$1@dont-email.me> X-Spam-Checker-Version: SpamAssassin 4.0.0 Bytes: 2941 Lines: 50 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