Deutsch English Français Italiano |
<6dc72d2d020f5648efbecad66062706d54fb28bc@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 13:32:08 +0200 Organization: i2pn2 (i2pn.org) Message-ID: <6dc72d2d020f5648efbecad66062706d54fb28bc@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> <998bef736d537e847808326b9d25a20cbeb2c6f4@i2pn2.org> <va9rjc$t0r0$2@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Fri, 23 Aug 2024 11:32:05 -0000 (UTC) Injection-Info: i2pn2.org; logging-data="3583259"; 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 In-Reply-To: <va9rjc$t0r0$2@dont-email.me> X-Spam-Checker-Version: SpamAssassin 4.0.0 Bytes: 2595 Lines: 50 Bart wrote: > On 23/08/2024 11:47, fir wrote: >> Bart wrote: > >> >> 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 > > > Actually it's one of the few places it makes sense! > > But I don't like this idiom for several reasons. Sure, it can be > convenient to write: > > for(int i=0; i<100; i++) > > without having to make an annoying detour to the top of the function to > write that declaration for i. But then you need a second loop, and a > third, and how you have to repeat a declaration each time: > > for(int i=0; i<200; i++) > > Better to do it once and forget about it. > > Then, it allows nested loops like this: > > for (int i = 0; i<A; ++i) > for (int i = 0; i<B; ++i) > for (int i = 0; i<C; ++i) > > All those i's are different! Only the last is accessible in the inner loop. > > > i never used nor even seen this with 3 i..for me as i said "loop" iteslf not neccessary belongs to inside of the loop more like the outside.. here liek this this is misleading that the i is one thing - until someone knows its just internat thing (but i as i said disagree it should be intennal)