Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: longer 'char literals' meaning in c Date: Fri, 01 May 2020 13:11:04 -0700 Organization: None to speak of Lines: 49 Message-ID: <87wo5v2z6v.fsf@nosuchdomain.example.com> References: <9bf151f2-e3f8-488b-bf10-9ba136d23a4f@googlegroups.com> <87sggk665l.fsf@nosuchdomain.example.com> <874kt061yl.fsf@nosuchdomain.example.com> <87tv104ij2.fsf@nosuchdomain.example.com> <4lKqG.254784$mk2.321@fx21.am4> <87lfmc4dwh.fsf@nosuchdomain.example.com> <4aea0111-3c1d-4763-82b5-20c56d0a7ad8@googlegroups.com> <878sib4mp4.fsf@nosuchdomain.example.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: reader02.eternal-september.org; posting-host="3a8562cb4f6a88758e42aeb600e70f1e"; logging-data="23199"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+kvE66nY4uFzTqAM00bq/0" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) Cancel-Lock: sha1:u/fBC5fu2SfHznOead9ywyloye8= sha1:OcUhBW5zG5v7y/fIIRGJe9OfVQo= Xref: csiph.com comp.lang.c:151933 Bart writes: [...] > I said this up-thread: > > BC:"C with 32-bit ints also limit the length to 4 characters." > > which you decided to dispute by pedantically saying that C allows more > than 4 characters, even though only 4 will be significant. > > How will that information be of use to anyone? It is of use *to most people here* to understand what the C standard actually says. I understand that you don't consider that to be of any use to you. I don't understand why you insist on discussing something that you claim not to care about, or why you seem to be unable to deal with the fact that other people *do* care about it. And I never said that 4 characters will be significant. It's very likely that 4 characters will be significant (for an implementation with 32-bit int and 8-bit char), but the standard doesn't guarantee it. > C doesn't magically let them write "if (cmd == 'ABCDEF')" in the same > way that the same implementation allows "if(cmd == 'ABCD')", and most > implementations don't even properly point out that the former will > never work as intended. > > To repeat: for all practical purposes, 32-bit C compilers that > meaningfully support 'ABC' constants at all, limit them to 'ABCD'. It depends on what you mean by "limit", something that you never made clear. Some compilers "limit" them by ignoring the extra characters, perhaps with a warning. Some "limit" them by rejecting them (which is non-conforming behavior). My point is this: A conforming C compiler must accept 'ABCDEF' as a valid character constant. Equivalently, a C compiler that rejects 'ABCDEF' (meaning that it fails to translate a translation unit containing it) is non-conforming. If you don't care about that fact, that's fine. If you agree with it, that's great. If you disagree with it, you're wrong. And if you want to drop this, now would be a good time. -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com Working, but not speaking, for Philips Healthcare void Void(void) { Void(); } /* The recursive call of the void */