From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,4c42ac518eba0bbe X-Google-Attributes: gid103376,public X-Google-Thread: 109fba,4c42ac518eba0bbe X-Google-Attributes: gid109fba,public X-Google-Thread: 1014db,4c42ac518eba0bbe X-Google-Attributes: gid1014db,public From: "Jos A. Horsmeier" Subject: Re: Coding for Obscurity Date: 1997/11/20 Message-ID: <3473F6E4.59E6362@and.nl>#1/1 X-Deja-AN: 291191168 References: <343fbb5a.0@news.iprolink.ch> <34466EB4.3381@dynamite.com.au> <6275dt$agm$3@news.on> <344BCED0.2D51@dynamite.com.au> <62tpap$7gh$1@darla.visi.com> <3470EF6E.F74@lysator.liu.se> <64qsf0$ccc@dfw-ixnews11.ix.netcom.com> <3474BF28.2F9F@dynamite.com.au> <650g12$dt5@dfw-ixnews9.ix.netcom.com> Organization: AND Software B.V. Rotterdam Newsgroups: comp.lang.ada,comp.lang.c,comp.lang.c++ Date: 1997-11-20T00:00:00+00:00 List-Id: firewind wrote: | Alan E & Carmel J Brain wrote: | > firewind wrote: | > > if(!to && !(to = malloc(sizeof *to)))) return(NULL); | > > | > > For 'verbose' code this would be written: | > > | > > if(!to) { | > > if(!to = malloc(sizeof *to)) { | > > return(NULL); | > > } | > > } | > > | > > I find this unacceptable. The first form is understood well enough anyway | > > The if(foo() || bar()) construct may seem obfuscated and weird to you, it | > > is the way the logic of some people's minds work. | > No further evidence, I rest my case. | > Would anyone in comp.lang.c like to comment? | From the new Subject: I assume you have drawn the conclusion that I code in | the above manner (the first 'weird' if(), I don't use the second, but the | point was that 'style imperialism' is stupid) to purposely obfuscate. Nothing | can be further from the truth. Obfuscated code can be written in absolutely | any language, by absolutely everyone. In a bad spot, a decidedly 'clean' | coder can churn out a potful of spaghetti code. Absolutely true. I don't want to start a 'style war' but I do want to comment; I tend to accept any style of code that I can _pronounce_; for example, your first if statement above doesn't look weird or obfuscated to me at all; to me, it reads: if I don't have a 'to' and if I can't get a 'to' I'm out of here. As a matter of fact I use (the negation of) this construct regularly: if I have a 'to' or if I can get a 'to', do the job: if (to || (to= malloc(sizeof *to))) else return NULL; it saves me a couple of 'not's and it shows a bit more positive attitude ;-) kind regards, Jos aka jos@and.nl