yank unary '+'?
Bill Baxter
wbaxter at gmail.com
Tue Dec 8 15:09:47 PST 2009
On Tue, Dec 8, 2009 at 2:28 PM, Lukas Pinkowski <Lukas.Pinkowski at web.de> wrote:
> Bill Baxter wrote:
>> I say you should completely chop it then. Leaving it in for literals
>> only leaves a mess that's hard to justify.
>> I have often written things like
>>
>> glVertex2f(-boxRadius,-boxRadius);
>> glVertex2f(+boxRadius,-boxRadius);
>> glVertex2f(+boxRadius,+boxRadius);
>> glVertex2f(-boxRadius,+boxRadius);
>
> I'm doing the same thing myself, too.
>
> I'm using the unary plus not only for documentation, but also for expressing
> intention: It symbolizes that I did not forget a minus sign for that
> specific value. This way a missing unary minus or unary plus makes me
> suspicious that I have done something wrong in my numerical code.
Well, you can use a leading space for that purpose too, with just
slightly more ambiguity of intent.
--bb
More information about the Digitalmars-d
mailing list