Path: csiph.com!1.us.feeder.erje.net!feeder.erje.net!1.eu.feeder.erje.net!border1.nntp.ams1.giganews.com!nntp.giganews.com!buffer1.nntp.ams1.giganews.com!nntp.brightview.co.uk!news.brightview.co.uk.POSTED!not-for-mail NNTP-Posting-Date: Thu, 10 Nov 2016 15:53:59 -0600 From: Gareth Owen Newsgroups: comp.lang.c Subject: Re: Compiler design in C? References: <87r36k1l4w.fsf@gmail.com> <3e47c9bc-1c0a-40dc-9dc3-92e88ace6c31@googlegroups.com> <87lgwrzvqt.fsf@gmail.com> <87lgwrdaiu.fsf@gmail.com> <87shqz7n08.fsf@gmail.com> <362fc76e-f4aa-4c66-abfd-ea4e8d87da47@googlegroups.com> <87y40ruk7u.fsf@gmail.com> Date: Thu, 10 Nov 2016 21:54:00 +0000 Message-ID: <87fumzngqv.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) Cancel-Lock: sha1:a+9kyVeuafGzQWRX7467yK9z8ng= MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Lines: 36 X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-CGhJ1ZA9lk4e/yiQNt15nf3X6UAQVYLM4Z05iqCOGd6f+s65AYJEx3Ft2GMYDRtGe757UWSn+H6ccTB!33q92153mE9Hm8TZBUxhwyHiZU0qShYgAjF5/4IEOhLJQlAnd1Jcr6WNR7/XKFfB6mQZ X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 2798 Xref: csiph.com comp.lang.c:96351 jacobnavia writes: > Le 10/11/2016 à 21:57, Gareth Owen a écrit : >> I actually considered mentioning this, but decided against it. > > And the reason was? I didn't consider it particularly relevant. > Why is the pre-processor such an "evil"? No. It's fine. > I find it OK, you can do a lot of things with the preprocessor. I find it OK, also. > 81 static int ResizeTo(ValArray *AL,size_t newcapacity) > 82 { > 83 ElementType *oldcontents; > 84 > 85 if (AL->capacity == newcapacity) return 0; > 86 oldcontents = AL->contents; > 87 AL->contents = AL->Allocator->realloc(AL->contents,newcapacity > * sizeof(ElementType)); > 88 if (AL->contents == NULL) { > 89 AL->contents = oldcontents; > 90 return NoMemory("ResizeTo"); > 91 } > 92 AL->capacity = newcapacity; > 93 AL->timestamp++; > 94 return 1; > 95 } What if I want two different containers in the same translation unit? What mitigation is there for multiple functions called ResizeTo?