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 <998bef736d537e847808326b9d25a20cbeb2c6f4@i2pn2.org>
Deutsch   English   Français   Italiano  
<998bef736d537e847808326b9d25a20cbeb2c6f4@i2pn2.org>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!weretis.net!feeder9.news.weretis.net!news.nk.ca!rocksolid2!i2pn2.org!.POSTED!not-for-mail
From: fir <fir@grunge.pl>
Newsgroups: comp.lang.c
Subject: Re: on allowing "int a" definition everywhere
Date: Fri, 23 Aug 2024 12:47:55 +0200
Organization: i2pn2 (i2pn.org)
Message-ID: <998bef736d537e847808326b9d25a20cbeb2c6f4@i2pn2.org>
References: <afdfe7c37c6ad739fd82c7ec0587b82e0963fce2@i2pn2.org> <va2i90$3f4dg$1@dont-email.me> <pan$8a32c$1fb86219$8ea0c6ae$7c2d1765@invalid.invalid> <va4id0$3rc3n$1@dont-email.me> <pan$2be2c$5ea44d54$282eec3$b0bcf030@invalid.invalid> <va727r$d1jq$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 23 Aug 2024 10:47:52 -0000 (UTC)
Injection-Info: i2pn2.org;
	logging-data="3578909"; mail-complaints-to="usenet@i2pn2.org";
	posting-account="+ydHcGjgSeBt3Wz3WTfKefUptpAWaXduqfw5xdfsuS0";
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:27.0) Gecko/20100101 Firefox/27.0 SeaMonkey/2.24
X-Spam-Checker-Version: SpamAssassin 4.0.0
In-Reply-To: <va727r$d1jq$1@dont-email.me>
Bytes: 3842
Lines: 104

Bart wrote:
> On 22/08/2024 09:40, Blue-Maned_Hawk wrote:
>> Thiago Adams wrote:
>>
>>> On 21/08/2024 01:42, Blue-Maned_Hawk wrote:
>>>> Thiago Adams wrote:
>>>>
>>>>> initializer inside if is already in C++, and it will probably be on
>>>>> C2Y.
>>>> If it's for consistency with how for loops permit declarations, i would
>>>> _much_  prefer that they just outlaw that to induce consistency.
>>>>
>>>> (Really, i'd ideally want things to just stay as they are, since
>>>> declarations in for loops are simply too useful for macros.)
>>>
>>> I like the ability to declare things inside if.
>>>
>>> if (FILE* f = fopen("file.txt", "r"))
>>> {
>>>     /*...*/ fclose(f);
>>> }
>>>
>>> Because it makes the scope of f, associated with the pointed object
>>> lifetime.
>>>
>>> For instance, if you try to use f
>>>
>>> if (FILE* f = fopen("file.txt", "r"))
>>> {
>>>     /*...*/ fclose(f);
>>> }
>>> fwrite(f, ..) ;// ERROR
>>
>> You can already do that in C23:
>>
>> if (…) {
>>     FILE * f = fopen("file.txt", "r");
>>     /* … */
>>     fclose(f);
>> }
>> fwrite(f, …);  /* Some kind of error happens. */
>>
>> Or, if you need it to exist before the controlling expression:
>>
>> for (bool x = true; x; x = false)  for (FILE * f = fopen("file.txt",
>> "r");
>> x; x = false)  if (…) {
>>     /* … */
>>     fclose(f);
>> }
>> fwrite(f, …);
>>
>
> I wonder, if I laid it out it properly:
>
>      for (bool x = true; x; x = false)
>          for (FILE * f = fopen("file.txt", "r"); x; x = false)
>              if (…) {
>                  /* … */
>                  fclose(f);
>              }
>      fwrite(f, …);
>
> Nope; I still haven't the faintest idea what this is supposed to do. I
> suspect that it doesn't actually run or need those two nested loops.
>
> I assume the (...) tests the value of 'f'? If so then perhaps this is a
> shorter way of expressing the same thing:
>
>      {
>          FILE * f = fopen("file.txt", "r");
>          if (f) {
>              /* … */
>              fclose(f);
>          }
>      }
>      fwrite(f, …);
>

btw maybe not so much relevent as what you write but
if to think the convention


foir(int i=0; i<100; i++)
{
   //,,,
}

to amke int i scope relevant to only inner of the loop seem just 
logically wrong

on assembly lebel you got outside of the loop inside of the loop
and loop code itself


loop:
    ....

   cmp ecx, 100
   jl loop


tehnically the loop as it can be breal it is more like that the loop 
counter may be just the result needed in the outside - so logical bug in 
c was here spotted