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 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: <87plmfu2ub.fsf@nosuchdomain.example.com> <87frnbt9jn.fsf@nosuchdomain.example.com> <877c8nt255.fsf@nosuchdomain.example.com> 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 writes: > On 28/11/2024 22:38, Keith Thompson wrote: >> Bart writes: >>> On 28/11/2024 19:58, Keith Thompson wrote: >>>> Bart 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 */