Warning: mysqli::__construct(): (HY000/1203): User howardkn already has more than 'max_user_connections' active connections in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\includes\artfuncs.php on line 21
Failed to connect to MySQL: (1203) User howardkn already has more than 'max_user_connections' active connections
Warning: mysqli::query(): Couldn't fetch mysqli in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\index.php on line 66
Article <877c8nt255.fsf@nosuchdomain.example.com>
Deutsch   English   Français   Italiano  
<877c8nt255.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 14:38:30 -0800
Organization: None to speak of
Lines: 67
Message-ID: <877c8nt255.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>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Date: Thu, 28 Nov 2024 23:38:32 +0100 (CET)
Injection-Info: dont-email.me; posting-host="5d82f7250b92e1d8e1e5ba7e656a3e2b";
	logging-data="741724"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX181Y7RWHbaEv/abukmyLbu3"
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:+Fb7lLLgHqyinCTAwY5fE1N6wWI=
	sha1:cj+Ae+hfW571kGgXfzfouoXUdNw=
Bytes: 3650

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.

>                                Other languages tend to have special
> keywords that apply to the variable declaration, not the type, for
> example:
>
>   let x:int        # non-mutable
>   var y:int*       # mutable (using whatever pointer syntax)

Yes, other languages are different.  Few, if any, languages that
are not based on C have adopted C's odd declaration syntax.

> 'const' C looks like it works like that, but it doesn't.

It doesn't look like it works like that if you understand how it
actually does work.

>                                                          There also
> examples like this:
>
>   int const * const p;
>
> Here storage for p is allocated, but it it the second 'const' that
> makes it readonly. The first 'const' is not involved in allocation at
> all. This is easy to get mixed up.

Yes, and you seem determines to make it easier to get mixed up.

[...]

> VLAs are mostly linked to stack allocation. But that only applies when
> the array is at the top level of the type spec, in the same why that
> it's the top-level 'const' that would determine whether storage is
> read-only - if declaring a variable.
>
> As I said, other languages tend to only have that top-level aspect. I
> consider that less confusing. I don't think you'd see multiple 'let'
> or 'mut' keywords within one variable declaration.

Other languages confuse you less than C does.  We know.

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */