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: Wed, 13 Jul 2016 13:24:53 -0700 Organization: None to speak of Lines: 42 Message-ID: References: <8760sc2aiz.fsf@bsb.me.uk> <57856cf1.441531@news.xs4all.nl> <9cfaefc2-92a1-4e03-aa6b-d071a0988c87@googlegroups.com> <87lh15s61q.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="19207"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19fN1kmy8RSzVhBqxl1LFvd" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:VUOPal5rt/OurV+nd8G53OWNu0E= sha1:FWIbarIHrtBKvwlpFbE3pwXL3Cw= Xref: csiph.com comp.lang.c:90347 BartC writes: > On 13/07/2016 20:15, Ben Bacarisse wrote: >> BartC writes: >> >>> ** has a long history of being used for exponentiation in programming >>> languages (notably in Fortran). >>> >>> But apart from not meaning a power operation in C, it's a little odd >>> that the * after A means one thing, and the * before B means another. >>> >>> (C is far from alone in allowing confusing combinations of >>> operators. In Python, ++A is quite legal, but it doesn't mean what it >>> does in C! It means +(+A). But at least each + means exactly the same >>> as the other. And Python uses ** to mean pow().) >> >> Many allow you to write A--B. The usual advise is better layout (and >> some might even advocate parentheses) not that the language be >> re-designed. > > Overloading "-" to mean both unary negate and binary minus is well known > from school arithmetic. It's less of a surprise. Until a language uses > "--" to have a third meaning (eg. decrement in C or pointer subtract in > one my old languages). In some languages "--" introduces an end-of-line comment. > I would anyway use brackets around -B if "-" was adjacent to another > operator. If I was in a hurry, I'd use a space. I'd use `A + B` rather than `A--B` (unless I had some specific reason to negate B and subtract the result from A, but then I'd probably have a comment explaining it). And yes, I'd write `A - -B`, or *maybe* `A - (-B)`. Just curious, how long do you think it's going to take you to get over your surprise that `*` has multiple meanings? -- 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"