Some idle comments about Linus' e-mail response and Linux
Some idle comments about Linus' e-mail response and Linux
Posted Mar 1, 2007 19:36 UTC (Thu) by nix (subscriber, #2304)In reply to: Some idle comments about Linus' e-mail response and Linux by pr1268
Parent article: Quote of the week
All the examples so far have been macro-level.
On the micro-level, it's Bad Taste to write code which `happens to work'
without concern that it's grossly, obviously disgusting. e.g. one I saw
many years ago (and fixed at once) had a function looking ocnceptually
something like (identifiers anonymized to protect the guilty)
struct foo *get_foo(int a, long b, const char *c);
and they wanted to return `a foo', `no foo to find' and `error while
looking for a foo'. So they returned a foo, NULL, and, um, (struct foo *)
1.
And *that* was bad taste. Sure the pointer was never dereferenced if it
was 1, so it wasn't technically a standards violation. But the hidden
unexpectedness of that return value, and the absence of any hint except in
its various callers that this might happen made it Bad Taste. (To add
insult to injury get_foo() also assumed a different meaning for a
null-string-valued `c' parameter and for a NULL `c'...)
(of course I called it. Of course I didn't expect this return value. But
when the program crashed on an error path, I didn't consider it *my*
fault. It was the fault of the author of get_foo(). Some adjustment of
55-odd callers later, and it was no longer doing such a vile thing.)
Posted Mar 2, 2007 0:41 UTC (Fri)
by cpeterso (guest, #305)
[Link] (3 responses)
http://msdn2.microsoft.com/en-us/library/aa363858.aspx
Posted Mar 2, 2007 1:00 UTC (Fri)
by k8to (guest, #15413)
[Link] (2 responses)
Posted Mar 3, 2007 2:05 UTC (Sat)
by nix (subscriber, #2304)
[Link] (1 responses)
Posted Mar 4, 2007 9:04 UTC (Sun)
by k8to (guest, #15413)
[Link]
I've unfortunately programmed the win32 api before, although in its "sanitized" form, called Mono.
Posted Mar 2, 2007 2:04 UTC (Fri)
by proski (subscriber, #104)
[Link] (1 responses)
Posted Mar 3, 2007 2:08 UTC (Sat)
by nix (subscriber, #2304)
[Link]
Win32's CreateFile() API scores many Bad Taste points:Some idle comments about Linus' e-mail response and Linux
The name, for starters.Some idle comments about Linus' e-mail response and Linux
The billion insane flags and magic secret interactions are worse. It makes Some idle comments about Linus' e-mail response and Linux
open()+fcntl() look sane and pleasant.
Oh absolutely. I just find it impressive that they couldn't even figure out that "files" are not just windows api constructs, but really exist on the disk, and so the name is just wrong. It's like opening and closing quotes to the explitive which is the implementation.Some idle comments about Linus' e-mail response and Linux
And here we see Linus himself suggesting almost the same thing. No, it's not that bad, since it's a valid pointer, but it's close enough :)
Some idle comments about Linus' e-mail response and Linux
The &bad_ctype is non-tasteless, I'd say. It's *transparent* and you can Some idle comments about Linus' e-mail response and Linux
easily tell what it's doing when you read the code. And it doesn't dump
core if you dereference it :)