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=2.1 required=5.0 tests=BAYES_40,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11390f,4c42ac518eba0bbe X-Google-Attributes: gid11390f,public X-Google-Thread: 1014db,4c42ac518eba0bbe X-Google-Attributes: gid1014db,public X-Google-Thread: 103376,4c42ac518eba0bbe X-Google-Attributes: gid103376,public X-Google-Thread: 109fba,4c42ac518eba0bbe X-Google-Attributes: gid109fba,public From: fred@genesis.demon.co.uk (Lawrence Kirby) Subject: Re: Programming language vote - results Date: 1997/11/23 Message-ID: <880301061snz@genesis.demon.co.uk>#1/1 X-Deja-AN: 291841690 References: <6501ih$r1a@dfw-ixnews10.ix.netcom.com> X-Mail2News-User: fred@genesis.demon.co.uk X-Complaints-To: abuse@demon.net X-Mail2News-Path: genesis.demon.co.uk X-Trace: mail2news.demon.co.uk 880301985 11420 fred genesis.demon.co.uk Organization: none Reply-To: fred@genesis.demon.co.uk Newsgroups: comp.lang.ada,comp.lang.apl,comp.lang.c,comp.lang.c++ Date: 1997-11-23T00:00:00+00:00 List-Id: In article <6501ih$r1a@dfw-ixnews10.ix.netcom.com> firewind@metroid.dyn.ml.org "firewind" writes: >Mike Smith wrote: >> firewind wrote in article >> <64qsf0$ccc@dfw-ixnews11.ix.netcom.com>... >> > I find myself using a construct like this a lot recently (snipped directly >> > from code I'm working on right now): >> > >> > if(!to && !(to = malloc(sizeof *to)))) return(NULL); >> > >> > For 'verbose' code this would be written: >> > >> > if(!to) { >> > if(!to = malloc(sizeof *to)) { >> > return(NULL); >> > } >> > } >> > > >> Yeah, and what's wrong with that? > >Nothing, obviously. The second form is invalid, it is interpreted the same as: if((!to) = malloc(sizeof *to)) { What is required at the very least is: if(!(to = malloc(sizeof *to))) { -- ----------------------------------------- Lawrence Kirby | fred@genesis.demon.co.uk Wilts, England | 70734.126@compuserve.com -----------------------------------------