| Deutsch English Français Italiano |
|
<8734jbt07i.fsf@nosuchdomain.example.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!weretis.net!feeder9.news.weretis.net!news.quux.org!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 15:20:17 -0800
Organization: None to speak of
Lines: 57
Message-ID: <8734jbt07i.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>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Date: Fri, 29 Nov 2024 00:20:18 +0100 (CET)
Injection-Info: dont-email.me; posting-host="f64fae3639db49189bd8f4bb24b9887f";
logging-data="741724"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19zSb3BDBEXZqJTMgjwnSTe"
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:PN7rkgHIhzLlDpTUgNbCoOSL36E=
sha1:OdobBEMpb8TX3UwF7Tbo7TV46rU=
Bytes: 3540
Bart <bc@freeuk.com> writes:
> On 28/11/2024 22:38, Keith Thompson wrote:
>> Bart <bc@freeuk.com> writes:
>>> On 28/11/2024 19:58, Keith Thompson wrote:
>>>> Bart <bc@freeuk.com> writes:
>>>> [...]
>>>>> I think 'const' is confusing for similar reasons that VLAs can be both
>>>>> confusing and awkward to implement.
>>>>>
>>>>> That's because both really apply to /types/, not directly to variables.
>>>> Sure. For example, given
>>>> const int n = 42;
>>>> n is of type `const int`, and &n is of type `consts int*`. Of course
>>>> that implies that n itself is const.
>>>
>>> But that is a separate thing. Suppose T was an alias for 'const int'. Then:
>>>
>>> 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?
>> Yes, and you seem determines to make it easier to get mixed up.
>
> C doesn't require any help from me for confusing features.
No, but people using C sometimes require help in resolving their
confusion rather than reinforcing it.
> The OP said
> it was confusing and I tried to point out why it might be.
>
> Obviously you as C expert will never be confused. But there are lots
> of less expert users of the language.
Not true. I am occasionally confused. I just don't brag about it, and
I'd rather help others avoid confusion than add to it.
[...]
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */