Path: csiph.com!news.mixmin.net!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Tim Rentsch Newsgroups: comp.lang.c Subject: Re: Are there any conformant C compilers? Date: Fri, 16 Sep 2022 06:52:10 -0700 Organization: A noiseless patient Spider Lines: 71 Message-ID: <86r10bl94l.fsf@linuxsc.com> References: <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> <865yhrpcl9.fsf@linuxsc.com> <20220913082247.233@kylheku.com> <86leqmm319.fsf@linuxsc.com> <87fsgthltw.fsf@nosuchdomain.example.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader01.eternal-september.org; posting-host="4a0db673561e161ba81b81715d43a3e1"; logging-data="4009491"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18+TnU3l0ruCRImcZ4lYWQq3qVFvv2PgW8=" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:HL2CunH8qUWYJKQfb6rRQ2mBAqs= sha1:aX9VQAYD21nO08OkNZ0oKHCWMU4= Xref: csiph.com comp.lang.c:167738 Keith Thompson writes: > Tim Rentsch writes: > >> Kaz Kylheku <480-992-1380@kylheku.com> writes: >> >>> On 2022-09-13, Tim Rentsch wrote: >>> >>>> 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? >>>> >>>> As far as ISO C is concerned, the token '726163' is a constant, >>>> not a literal, and is a value rather than an object. >>> >>> The term "literal" in computer science is a shortening of >>> "literal constant". (There are also symbolic/manifest constants.) >> >> I am not aware of any authoritative reference that defines the >> term "literal" for the field of computer science. >> >> In any case, my comments are only about how the terms "literal" >> and "constant" are used in the ISO C standard. This newsgroup is >> comp.lang.c, and I see nothing wrong in restricting the domain of >> my remarks to just that of the C language. > > Sure, but plenty of people informally use the word "literal" to > refer to constants. Even K&R2's reference manual says: > > The characters /* introduce a comment, which terminates with > the characters */. Comments do not nest, and they do not > occur within string or character literals. I acknowledge the existence of other usages. I just don't think it's helpful to confuse the conversation by mixing in those other usages when talking about how to understand the C standard. > As much as I prefer to use the terminology defined in the standard, > I have no real problem with referring to 42 or 'x' as a literal. Aren't you one of the people who advocates using terminology as it is used in the C standard when writing comp.lang.c postings? That's all I'm doing. I don't see any reason why this case should be different. > I suggest that the "key difference" you see ("constants" are > values, and "literals" are objects") is accidental. I see no reason to think that is true. Do you have any facts to support this hypothesis? If anything, the consistency of usage observed in the C standard (at least eight different kinds of constants, two kinds of constant expressions, and two kinds of literals), plus the high quality of writing in the C standard generally, both suggest that the choice was deliberate, and not accidental. The existence of the quote you gave from K&R2 adds more weight to that conclusion: surely the authors of the ANSI and ISO C standards must have known of that comment, yet they chose "character constant" rather than "character literal" when writing the standards documents.