Deutsch English Français Italiano |
<67238AB5.5000101@grunge.pl> 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: else ladders practice Date: Thu, 31 Oct 2024 14:48:37 +0100 Organization: i2pn2 (i2pn.org) Message-ID: <67238AB5.5000101@grunge.pl> References: <3deb64c5b0ee344acd9fbaea1002baf7302c1e8f@i2pn2.org> <vg00gg$2mufa$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: i2pn2.org; logging-data="303852"; 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 To: nospam.harnden@invalid.com In-Reply-To: <vg00gg$2mufa$1@dont-email.me> X-Spam-Checker-Version: SpamAssassin 4.0.0 Bytes: 2129 Lines: 56 Richard Harnden wrote: > On 31/10/2024 12:11, fir wrote: >> somethins i got such pices of code like >> >> if(n==1) {/*something/} >> if(n==2) {/*something/} >> if(n==3) {/*something/} >> if(n==4) {/*something/} >> if(n==5) {/*something/} >> >> technically i would need to add elses - but the question is if to do that > > Why not ... > > switch (n) > { > case 1: > /* something */ > break; > > case 2: > /* etc ... */ > > default: > /* something else */ > } > > ... ? > switch is literally flawed construction - (i was even writing or at kleast thinking why, last time but sadli i literrally forgot my arguments, would need to find that notes) so i forgot why but i forgiot that it is flawed - i mean the form of this c switch has sme error >> >> do teh code has really chance to be slower without else (except some >> very prmitive compilers) ?? >> >> not adding else makes liek code shorter.. so im not literally sure >> which is better > > The size of teh [sic] source code won't make any difference to the size > of the executable - so aim for readability first and foremost. > > > >