jack: (Default)
[personal profile] jack
*sigh* There were other more funadmental problems, but instrumental in the bug was my muddling the precedence of "&" and "==". Obviously, we all make these mistakes sometimes. And I've got a lot better at avoiding minor mistakes as I've taken a more professional approach to programming.

But does everyone else (who programs) still find such typos happening?

For that matter, surely there is room for improvement in editors. Most people I know seem to use emacs, UltraEdit at work, vi if they're contrary, or Visual Studio if that's what they're using. But without going into details of which I've thought a lot, there seems a lot more that could be done to make minor errors, time spent comprehending code, etc, which eats up lots of productivity better? Surely it's the most obvious project for any programmer to want to work on?

Date: 2006-08-01 05:51 pm (UTC)
simont: A picture of me in 2016 (Default)
From: [personal profile] simont
Perhaps those programmers who feel a serious need for extra help from the editor aren't productive enough to write the code to do it, whereas those who are productive enough don't need it in the first place :-)

Date: 2006-08-01 11:21 pm (UTC)
From: [identity profile] cartesiandaemon.livejournal.com
LOL. It's true to some extent. Particularly, they might well think so: I think it's somewhat common for good programmers to dislike such helpful things[1], so they don't think they need it. Even if it would help them get even better.

Of course, like so many things, it's probably valuble to learn the hard way first...

[1] Possible reasons: they've been exposed to many bad systems; they feel it's patronising; they're good at working without it, which skills become less important with it.

Date: 2006-08-01 06:02 pm (UTC)
ext_8103: (Default)
From: [identity profile] ewx.livejournal.com

A good compiler can help:


sfere$ cat t.c
int f() { return 1 & 1 == 0; }
sfere$ gcc -Wall -c t.c
t.c: In function `f':
t.c:1: warning: suggest parentheses around comparison in operand of &

(Of course the warning assumes that you meant what you wrote, which is probably not the case here, but that's fine, it tells you there's something wrong anyway.)


A good compiler can help:

Date: 2006-08-01 11:22 pm (UTC)
From: [identity profile] cartesiandaemon.livejournal.com
Oh yes, good point. *That's* an area which has improved immensely.

Memo to self: do avoid warnings.

Re: A good compiler can help:

Date: 2006-08-01 11:30 pm (UTC)
From: [identity profile] fluffymormegil.livejournal.com
Memo to [livejournal.com profile] cartesiandemon: Set -Werror in your Makefile unless your system headers are bollixed.

Re: A good compiler can help:

Date: 2006-08-01 11:47 pm (UTC)
From: [identity profile] cartesiandaemon.livejournal.com
Thanks. Zero-warning is supposedly being adopted as company policy. But at the moment there are still too many warnings from other people's edits for it to be plausible to deal with them all :(

Re: A good compiler can help:

Date: 2006-08-02 08:08 am (UTC)
ext_8103: (Default)
From: [identity profile] ewx.livejournal.com
That's why you turn -Werror on everywhere - so that people can't even compile until they've eliminated warnings from the change.

Re: A good compiler can help:

Date: 2006-08-02 08:07 am (UTC)
ext_8103: (Default)
From: [identity profile] ewx.livejournal.com
System headers are exempted from warnings in vaguely recent versions of GNU C (essentially they use -isystem.)

Date: 2006-08-01 07:57 pm (UTC)
From: [identity profile] geekette8.livejournal.com
But does everyone else (who programs) still find such typos happening?

Yes, I do, and I've also found similar things in other code I've had to work with.

I use Visual Studio and I actually quite like it as an editor, although not as an IDE (I use command line build systems in general).

Date: 2006-08-01 09:26 pm (UTC)
From: [identity profile] fluffymormegil.livejournal.com
I tend towards paranoiac parenthesisation.

Date: 2006-08-01 11:27 pm (UTC)
From: [identity profile] cartesiandaemon.livejournal.com
Oh yes, indeed. The trouble is you end up with a rats nest of *those*, and then you can't see what's supposed to be grouped with what, or if you typo'd one into the wrong place.

If it was visually obvious (eg. parenthesies represented on screen with colours, like in excel) it'd be easier to see at a glance if it was right.

Date: 2006-08-01 11:33 pm (UTC)
From: [identity profile] fluffymormegil.livejournal.com
That's why I tend to paranoiacally put linebreaks (using my autoindenting editor) in long parenthetical constructs at suitably locations.

Date: 2006-08-01 11:46 pm (UTC)
From: [identity profile] cartesiandaemon.livejournal.com
Again, yes... but then a statement which might be doing something conceptually simple sprawls across much screen space, and you can't see the overall outline of the function because this bit is so prominent. You have to go put it in a function or something...

Date: 2006-08-01 10:11 pm (UTC)
From: [identity profile] keithlard.livejournal.com
But does everyone else (who programs) still find such typos happening?

Sure.

Date: 2006-08-02 06:24 am (UTC)
From: [identity profile] bouteillebleu.livejournal.com
But does everyone else (who programs) still find such typos happening?

Well, not that particular example, since our programming language doesn't have an & or any form of AND. :)