Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: double free Date: Tue, 12 Jul 2016 09:16:14 -0700 Organization: None to speak of Lines: 35 Message-ID: References: <48c43c3f-8e7e-0509-5b9d-04133e7bb537@verizon.net> <57837892.8808984@news.xs4all.nl> <481f30b4-acb3-4445-92b3-c403dc3e51f7@googlegroups.com> <8760sc2aiz.fsf@bsb.me.uk> <87twfv26cv.fsf@bsb.me.uk> <87bn2317dl.fsf@bsb.me.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="945944de09706c9b4e29b53c9d2efdc2"; logging-data="10518"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Gy8U8fIxZDVMTXcMPUymq" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:l8x6PBE7UAkp6nKEu/koqx3Xxmg= sha1:VeWYOHVSjafGkTELAFUKhxEISt0= Xref: csiph.com comp.lang.c:90277 BartC writes: [...] > sizeof needs parentheses anyway when applied to a type, so necessarily > have to look like a function call. (And I suspect most don't even know > whether it is types or expressions that don't require the parentheses, > so add them just in case!) When I write C code, I don't cater to an audience that doesn't know C. Someone who doesn't understand what `sizeof n` or `sizeof *p` means is likely to have a hard time reading my code. The solution (which you seem to object to) is to learn the language. When I apply sizeof to a parenthesized type name, I leave a space between the keyword and the "(": sizeof (int) (I do the same if the operand happens to be a parenthesized expression, though that's fairly rare.) When I write a function call, the function name and the "(" are adjacent: func(arg) You can argue that `sizeof (int)` looks like a function call (*if* you pretend that "sizeof" is an ordinary identifier rather than a keyword and that "int" is an expression), but a reasonable coding style can (and IMHO should) make them visually distinct. -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"