Re: slurping in binary data
- From: George <george@xxxxxxxxxxxxxxx>
- Date: Wed, 10 Dec 2008 19:32:14 -0700
On Mon, 08 Dec 2008 01:36:13 GMT, James Kuyper wrote:
On Wed, 03 Dec 2008 03:04:35 GMT, James Kuyper wrote:...
...program comes in. My own most fundamental rule for debugging programs is
that I must figure out precisely why it is that I don't expect the bug
to occur. I must have an argument, with a series of premises assumed to
be true, that reaches the conclusion that the bug should not be
I usually find that one of the premises is false. Sometimes that
immediately tells me what's wrong. More often, I need to apply this
procedure recursively: I now need to determine why I incorrectly thought
that the premise should be true. However, the recursion always
Thanks for your comment. It seems relevant to the fella who's asking about
fclose elsethread. Making a log makes sense. I think a lot of C
programming overtests for failure, in particular, when the platform and
target is one's own PC as opposed to a memory-mapped device.
The execution in fortran programs is discussed in terms of recursion, which
I didn't read in yesterday's reading of chp 5 of 1256.pdf. Of course,
you're describing the thought process as it works for you.
I'm not sure what that comment means, since I'm not sure what it is that
Fortran describes in term of recursion. n1256.pdf uses the concept of
recursion in many places, but there's only one use of the term in the
first five sections: 126.96.36.199p4.
I suspect that you're thinking in terms of recursive function calls,
which section 188.8.131.52p11 requires to be supported in C. But I was using
the term in a broader sense, like most of the other uses of that term in
the standard, few of which involve function calls.
Let me give a simplified example. I recently investigated a bug where
there were missing packets from the output files of one of my programs.
I started by constructing an argument why the packets should not be
missing. Several of the key premises of that argument were based upon
certain assumptions about the contents of the input files. Because those
were the easiest things to check, they were also the first things I
checked (despite direct orders from upper management that I was not
supposed to "waste" any time investigating the "impossibility" that
those input files were defective). What I found was that the packets
were missing from my program's output for the simple reason that they
were missing from it's inputs; we knew from an alternative source that
those packets should have been there.
At this point, recursion kicks in. Having established that my original
argument was incorrect because one of it's premises was false, my next
step was to consider why I had expected those files to have those two
files to contain the same packets. It was because I had been told,
third-hand, that the alternative source of those packets was created by
processing the primary source. Therefore, there shouldn't be any packets
in the alternative source that weren't in the primary source. I decided
that I needed first hand information, rather than third-hand. It turns
out that neither of the two different sources we were looking at were
produced from the other. Both were produced from the same input files by
Once again, recursion kicked in. Having established that the two
different programs were producing inconsistent outputs from the same
input files, it was time to consider why those programs were expected to
produce consistent outputs. I didn't handle that part of the
investigation, and don't know any details about it, because those
programs were someone else's responsibility. However, at my request that
person did investigate, and has reported discovering a bug which should
be fixed sometime in January.
I hope that makes it clearer what I meant about the debugging process
Thanks for your comment and the enlightening narrative. It reminds of
Hofstadter's amusing narratives that explore the nature of "if false."
My comment was meant to compare your thought process, the fortran standard,
and the C standard. I"ve only read the chapters on execution in both
syntaxes for the first time just this last week, so I make no pretense to
My impression is that fortran achieves through recursion what C does with
sequence points, as far as how the behavior in the abstract machine is
James, thanks for your comment throughout this thread. I see that my next
reply ends with an insult, so I'll declare abandon thread now.
The deliberate and deadly attacks which were carried out yesterday against
our country were more than acts of terror. They were acts of war.
George W. Bush
Picture of the Day http://apod.nasa.gov/apod/
- Prev by Date: Re: Addressing multidimensional arrays
- Next by Date: Re: making bytes out of bits
- Previous by thread: Re: slurping in binary data
- Next by thread: Re: slurping in binary data