Path: csiph.com!news.mixmin.net!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Are there any conformant C compilers? Date: Mon, 12 Sep 2022 09:33:05 -0700 Organization: None to speak of Lines: 34 Message-ID: <87edwgimda.fsf@nosuchdomain.example.com> References: <87wnaoghlj.fsf@nosuchdomain.example.com> <87sflahhkp.fsf@nosuchdomain.example.com> <87fsh9iz25.fsf@bsb.me.uk> <11d1020d-144d-4da0-88c1-3d56b4160c2an@googlegroups.com> <87pmgdh85z.fsf@bsb.me.uk> <878rn1h5lk.fsf@bsb.me.uk> <9586550c-6a4b-4a75-a10a-25f26e109b85n@googlegroups.com> <87tu5pfm0t.fsf@bsb.me.uk> <38331300-95c3-4499-aa89-062b82974309n@googlegroups.com> <87czccfyq0.fsf@bsb.me.uk> <86mtb5p6gd.fsf@linuxsc.com> MIME-Version: 1.0 Content-Type: text/plain Injection-Info: reader01.eternal-september.org; posting-host="b26c9846d0a6c973f5b57932d4152a5b"; logging-data="2422425"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+39vWorm6dxLlJ8N8if9pc" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) Cancel-Lock: sha1:gvfvVOb4PyVR9Jr+/ksBUCnQQQg= sha1:K2nIYnCXVEisRg+nDLLiKQaWNeo= Xref: csiph.com comp.lang.c:167647 Bart writes: > On 12/09/2022 05:22, Tim Rentsch wrote: >> Ben Bacarisse writes: > >>> Thinking about it a bit more, the common factor with all literals is >>> that they represent /anonymous/ values. Without compound literals you >>> could not write a value of any aggregate type, other than char[]. >> The key difference is that "constants" are values, and "literals" >> are objects. > > So a literal like 726163 is an object, and not a value? > > Okay... > > I've never really used 'literal' but picked it up from hanging around here. > > Personally, I'd use 'integer-constant' for 726163, 'char-constant' for > 'A', 'real-constant' for 72.6163, and 'string-constant' for "ABC". The C standard calls 726163 a "constant", not a "literal". It uses the term "literal" only for string literals and compound literals. However, other languages do refer to 726163 as a "literal" (my vague impression is that *most* languages do so; certainly C++ does), and it's common for C programmers to use the term "literal" informally. Which is why I don't particularly like the idea that constants are values and literals are objects. It happens to work out that way using the terminology of the C standard, but I don't think it's a general principle. -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com Working, but not speaking, for Philips void Void(void) { Void(); } /* The recursive call of the void */