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: Sun, 11 Sep 2022 21:07:12 -0700
Organization: A noiseless patient Spider
Lines: 50
Message-ID: <86r10hp767.fsf@linuxsc.com>
References: <87v8q8qygb.fsf@bsb.me.uk> <87bks0pdex.fsf@bsb.me.uk> <871qswi3nc.fsf@nosuchdomain.example.com> <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>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: reader01.eternal-september.org; posting-host="117318903d4b6f4d84a8201305c52178"; logging-data="2300153"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+yXvH7jAllZOUZZ7Sn1szcdAWXQC60jeU="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:+IbGtw+Q1SllJgvV1gShsJYsxdQ= sha1:z+9DAYOGpDs9PyVntd50mI/djp4=
Xref: csiph.com comp.lang.c:167625
Ben Bacarisse writes:
> Thiago Adams writes:
>
>> On Friday, September 2, 2022 at 1:53:06 PM UTC-3, Bart wrote:
>>
>>> On 02/09/2022 16:19, Ben Bacarisse wrote:
>>>
>>>> Bart writes:
>>>>
>>>>>>> The only other actual literal is a string.
>>>>>>
>>>>>> How about compound literals?
>>>>>
>>>>> The 'literal' in those is just a term somebody decided use.
>>>>
>>>> They are literals because they describe a specific value in the source
>>>> code. The value is "literally" in the source.
>>>>
>>>>> (Elsewhere I would call them constructors.)
>>>>
>>>> Sure. And the ASCII digit 1 is a constructor for an int value. And a "
>>>> optionally followed by characters and another " is a constructor for a
>>>> char array object.
>>>>
>>>> Both terms work, but the one C has chosen is "literal".
>>>
>>> Some constructors are special:
>>>
>>> 123456
>>> 123.456
>>> "abcdef"
>>> 'A'
>>>
>>> because they can /only/ comprise values known at compile-time. These I
>>> like to call literals.
>>
>> Compound literals also are values known at compile time.
>
> They /may/ be but they don't have to be (except at file scope). And yet
> the syntax is still called a compound literal.
Even at file scope the values might not be known at compile time.
For example, in this code
extern int x;
void **foo = &(void*){ &x };
the value '&x' is not known until link time.