Re: get rid of warning "suggest parenthesis around assignment used as truth value"
Re: get rid of warning "suggest parenthesis around assignment used as truth value"
- Subject: Re: get rid of warning "suggest parenthesis around assignment used as truth value"
- From: Alex Curylo <email@hidden>
- Date: Thu, 20 Nov 2008 06:15:52 -0800
On 20-Nov-08, at 5:32 AM, email@hidden wrote:
Follow the suggestion given in the warning itself, and add another
set of parenthesis:
if ((foo = 1)) { ... }
sherm--
Um, that's just what I *don't* want to do, unless it's the only way.
It's a small thing but that is just so unnecessary - and ugly IMHO.
Bob
Well, I won't presume to argue the ugly point, as the aesthetic appeal
of source code listings is not a worthwhile metric of technological or
financial success so far as I am aware, but I very VERY strongly
disagree with you that it is unnecessary.
See, I spend a good bit of time porting Windows code, masochist that I
am, and that warning has caught "=" in place of "==" in code I was
given from Windows clowns who laughingly call themselves programmers,
if not hundreds, certainly well into the dozens of times.
That's a mighty fine tradeoff for having to type a few extra brackets
here and there.
And in any case, I would say that properly self-documenting code
should always explicitly check the result of a control flow assignment
against nil (or whatever). That's what I do when writing my own code
so this warning never shows itself. And if you're not doing it that
way, then I say you're not writing your code maintainably enough.
--
Alex Curylo -- email@hidden -- http://www.alexcurylo.com/
Programming is like sex...
One mistake and you support it the rest of your life.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden