Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Tim Rentsch Newsgroups: comp.lang.c Subject: Re: longer 'char literals' meaning in c Date: Sun, 24 May 2020 17:36:26 -0700 Organization: A noiseless patient Spider Lines: 31 Message-ID: <86blmcu9yt.fsf@linuxsc.com> References: <87tv104ij2.fsf@nosuchdomain.example.com> <4lKqG.254784$mk2.321@fx21.am4> <87lfmc4dwh.fsf@nosuchdomain.example.com> <87h7wu15dv.fsf@nosuchdomain.example.com> <87d07i0y4r.fsf@nosuchdomain.example.com> <878si5225f.fsf@nosuchdomain.example.com> <87lfm4ztok.fsf@nosuchdomain.example.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="584218407dd48c03052bd48ab913b64e"; logging-data="31238"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/ytTYwx8Pq9EtBrr414uaPANdIozIp5Z0=" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:SSVSSWxVVz6W13Ik/tmG9DdJU6s= sha1:+GCUfbwsxaRtXLfC/qAb1gTtwDs= Xref: csiph.com comp.lang.c:152456 Spiros Bousbouras writes: > On Thu, 07 May 2020 13:48:23 GMT > Spiros Bousbouras wrote: > >> 1. The documentation of the implementation must describe an >> algorithm [*] which for every "integer character constant >> containing more than one character" (MT1CC for short) returns an >> integer value. > > Here's an amusing way to do so. The first MT1CC encountered gets > the value -1. Every new MT1CC encountered , if it has been > encountered before , gets the same value as before , otherwise gets > the value N-1 where N is the minimum value which has been assigned > to a MT1CC up to that point. Perhaps the programmer will be able to > decide with a command line flag whether the list of MT1CC already > encountered gets reset every time translation moves to a new > translation unit given on the command line or the list gets added to > over the whole compilation. > > I don't have a use for this but it strikes me as more interesting > than treating MT1CCs as numbers in base UCHAR_MAX+1 ; the latter can > easily be handled in many ways. This scheme is not conforming. The constants chosen by a given implementation must be the same from program to program, even if compiled on a different computer. There is no way to do that using a scheme like the one described above. (Perhaps this suggestion was meant as a joke. If it was, well, did you hear about the snail who crawled into a car dealership?)