File I/O - rawWrite issues

H. S. Teoh hsteoh at quickfur.ath.cx
Wed May 8 17:29:05 PDT 2013


On Thu, May 09, 2013 at 01:11:00AM +0200, Carl wrote:
> Wow, I feel silly.
> 
> In the process of making sample code I found the problem: I have
> been reading the output with a text editor instead of a hex editor.
> To think I spent hours on this problem... *face palm*
[...]

No need to be embarrassed; it happens to the best of us. IME, some of
the most frustrating, hair-pulling bugs that take hours (or days!) to
get to the bottom of often turn out to be dead-easy trivial mistakes
that got overlooked because they were *too* obvious.

I remember an embarrassing occasion where I got so frustrated that the
compiler is adamantly producing wrong code when the source code is
*obviously* correct, that I reinstalled the entire GCC toolchain, C
library, the entire works, only to find that it *still* didn't help.
Finally I discovered that it had nothing to do with the compiler /
libraries at all. It was a trivial typo substituting , for ; in the
wrong place in my code, thus subtly changing its meaning while leaving
only a few pixels difference in the appearance of the source code. I
spent the better part of a day finding this problem. *sigh*

Or another occasion where I got so frustrated when a code change deep
inside some complicated algorithm mysteriously had no effect on the
output whatsoever, even after inserting printf's into the code and
verifying that the new code did actually get run. Many hair-pulling
hours later, I suddenly realized that I had been looking at the wrong
output file -- that containing stale output from an earlier test run
before the code change.  *face palm for 5 full minutes*.


T

-- 
Why do conspiracy theories always come from the same people??


More information about the Digitalmars-d-learn mailing list