| Deutsch English Français Italiano |
|
<87v7w6ss38.fsf@nosuchdomain.example.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith Thompson <Keith.S.Thompson+u@gmail.com>
Newsgroups: comp.lang.c
Subject: Re: question about linker
Date: Thu, 28 Nov 2024 18:15:39 -0800
Organization: None to speak of
Lines: 43
Message-ID: <87v7w6ss38.fsf@nosuchdomain.example.com>
References: <vi54e9$3ie0o$1@dont-email.me> <vi6sb1$148h7$1@paganini.bofh.team>
<vi6uaj$3ve13$2@dont-email.me>
<87plmfu2ub.fsf@nosuchdomain.example.com>
<vi9jk4$gse4$1@dont-email.me> <vi9kng$gn4c$1@dont-email.me>
<87frnbt9jn.fsf@nosuchdomain.example.com>
<viaqh0$nm7q$1@dont-email.me>
<877c8nt255.fsf@nosuchdomain.example.com>
<viasv4$nm7q$2@dont-email.me>
<8734jbt07i.fsf@nosuchdomain.example.com>
<vib23k$p0pn$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Date: Fri, 29 Nov 2024 03:15:40 +0100 (CET)
Injection-Info: dont-email.me; posting-host="f64fae3639db49189bd8f4bb24b9887f";
logging-data="840809"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19eIqU9eBX0ZJkjFwDMX3DZ"
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:X6MGluUFZI+h83/mlZyxPnxmK+w=
sha1:pgytfRuAXOlpoy6MEchw0AtBKrw=
Bytes: 3012
Bart <bc@freeuk.com> writes:
> On 28/11/2024 23:20, Keith Thompson wrote:
>> Bart <bc@freeuk.com> writes:
>>> On 28/11/2024 22:38, Keith Thompson wrote:
>
>>>>> T x; // defines a readonly variable (which probably needs
>>>>> // initialising)
>>>>> T* y; // defines a variable pointer
>>>>>
>>>>> 'const' is out of the picture.
>>>> You say T is an alias (what, a macro?) for 'const int', you show code
>>>> using T, and then you say "'const' is out of the picture". If you
>>>> have a point, it escapes me.
>>>
>>> Well, can you see 'const' in my example? You can't tell x is readonly
>>> by only looking at this.
>> Yes, you said that T is an alias for 'const int'. Not sure why you
>> wrote "alias". Is it a macro, or a typedef, or something else?
>> I suggest that hiding "const" behind a macro or typedef is usually a
>> bad idea. Why did you do it here? Is your example based on real
>> code, or did you contrive it to be as confusing as possible?
>
> It's to illustrate that the constness of a variable may depend on
> something which is remote from its declaration.
>
> Which is unlike how it usually works elsewhere.
>
> (And if it matters, the alias used a typedef.)
>
> For extra confusion, consider this version:
>
> T x, *y;
>
> The storage for x is read-only; for y it isn't. Or is it the other way
> around?
Yes, deliberately confusing code is confusing. Yes, different languages
are different. Any problems with your code snippets can be solved by
writing them more straightforwardly.
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */