Index
Home
About
Blog
Date: Sun, 19 Mar 2000 09:54:50 -0800 (PST)
From: Linus Torvalds <torvalds@transmeta.com>
Subject: Re: [bugfix] SMP, shm-2.3.52-A0
Newsgroups: fa.linux.kernel
On Sat, 18 Mar 2000, Jeremy Fitzhardinge wrote:
>
> Properly used, asserts are not debugging code so much as executable design
> constraints.
No.
I've had this problem before, and I don't like it.
I've worked on projects where the above happened, and it turned out that
people ended up doing extra work just to make sure that the asserts were
"right", instead of realizing that the thing that the assert "documented"
was no longer worth maintaining.
I donot like asserts. I like temporary debugging aides, and I like them
just as long as they are _seen_ as temporary debugging aides.
99% of all asserts I've ever seen have been a complete waste of time. They
were useful when the code was written, because the code was buggy (or more
often the code was not buggy, but all the "surrounding" code that depended
on that piece of functionality had not been updated to new semantics). But
they become either a liability or just worthless over time.
That's just my opinion, of course. I know that my views on debugging are
pretty much scoffed at by a lot of people: I don't like debuggers either
(for somewhat similar reasons - my strongly held personal belief is that
debuggers tend to cause the _symptoms_ to be fixed rather than the actual
underlying bugs that you fix when you think about the problem on a source
level).
This is why I like BUG(). Not because it is any different from "assert()"
in any real sense, but because it does not have the psychological mindset
associated to it that "assert()" has..
Linus
Index
Home
About
Blog