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 connectionsPath: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: Andrey Tarasevich Newsgroups: comp.lang.c Subject: Re: Regarding assignment to struct Date: Mon, 5 May 2025 01:29:47 -0700 Organization: A noiseless patient Spider Lines: 29 Message-ID: References: <86plgo7ahu.fsf@linuxsc.com> <20250505111213.00004b55@yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Mon, 05 May 2025 10:29:52 +0200 (CEST) Injection-Info: dont-email.me; posting-host="6d007ba759295ef95801e2256a2aea14"; logging-data="84243"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+N9ibXW3fAJDx1ubgVpbS2" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:ycoR0llIGvppmRPywIXVFBIZ9ng= In-Reply-To: <20250505111213.00004b55@yahoo.com> Content-Language: en-US Bytes: 1879 On Mon 5/5/2025 1:12 AM, Michael S wrote: > > According to my understanding, you are wrong. > Taking pointer of non-lvalue is UB, so anything compiler does is > conforming. > Er... What? What specifically do you mean by "taking pointers"? The whole functionality of `[]` operator in C is based on pointers. This expression (a = b).a[5] is already doing your "taking pointers of non-lvalue" (if I understood you correctly) as part of array-to-pointer conversion. And no, it is not UB. This is not UB either struct S foo(void) { return (struct S) { 1, 2, 3 }; } ... int *p; p = &foo().a[2], printf("%d\n", *p); So, what you are basing your "UB" claim on is not clear to me. -- Best regards, Andrey