[SDL] [OT] "Text has zero width" isn't an error.

Pierre Phaneuf pphaneuf at gmail.com
Fri Apr 17 05:48:08 PDT 2009


On Fri, Apr 17, 2009 at 7:34 AM, Edward Cullen
<screamingwithnosound at googlemail.com> wrote:

> The 'halting' problem states that there is no *general* Turing Machine
> that is capable of determining whether a given (Turing Machine)
> program and input will terminate. It does *not* preclude one machine
> examining another in *restricted* cases. For example, it would be
> possible to write a turing machine to determine that the C "while
> (1);" does not terminate, but that is a special case, not a general
> case.

Not to mention that Valgrind doesn't do any static code analysis at
all, and thus doesn't even *try* to solve the halting problem. Thus,
it's solvability (or lack thereof!) is completely irrelevant.

In order for helgrind to point out there is a possible race condition,
the two pieces of code that will be racing have to be executed at some
point (on the same data), while running under helgrind. What helgrind
will do is notice two memory access to the same location that are done
without holding any common locks. What this means is that it reports
on race conditions without having to observe the race actually
failing.

So if your code works because it's lucky (maybe the read and the write
to that memory location are very far apart, and so could only fail in
some rather contrived case involving unexpected caching on an SMP
system), helgrind will still tell you about the bug. But if the
function that is missing a lock is all called from the same thread,
helgrind will not figure out that it'd be broken if you changed your
code to call this function from another thread, because that never
actually happens in your program.

-- 
http://pphaneuf.livejournal.com/



More information about the SDL mailing list