Error Message useless
Nick Sabalausky
a at a.a
Sat May 10 02:03:38 PDT 2008
"Mike" <vertex at gmx.at> wrote in message news:op.uaxjm1sjkgfkbn at lucia...
> On Sat, 10 May 2008 08:12:25 +0200, Nick Sabalausky <a at a.a> wrote:
>
>> Then do this:
>>
>> void main()
>> {
>> Stdout("1").newline;
>> someFunc();
>> Stdout("2").newline;
>> if(something)
>> {
>> Stdout("3").newline;
>> doSomething();
>> Stdout("4").newline;
>> }
>> Stdout("5").newline;
>> anotherFunc();
>> Stdout("6").newline;
>> yetAnotherFunc();
>> Stdout("7").newline;
>> }
>
> Oh ... how many time have I wished there was an IDE command to do that :)
You've just made me feel incredibly stupid. That particular "Why in the
world did that never occur to me?" kind of stupid. My forehead still hurts
from the smack. ;)
I'll have to attempt that next time I use an IDE that has programmable
macros (Visual Studio). Hmm, I wonder if C::B has macros...
> I do this all the time and I've always wondered if other people do that
> too ... I call it "laying traps" and I found usually it's best to first
> put not too many Stdouts in there, e.g. one every 4-5 statements if you're
> not really sure where the error happens. Then you can go in and put some
> "3a" "3b" and so on to find the exact statement that causes the problem.
Heh, yup. Same thing here. I always think of it like playing that old "HiLo"
number-guessing game that used to be a staple of learning a new language.
>
> That's, btw, a good reason to put single-line-if/elses into {}s instead of
> writing them on the same line. Easier to put Stdouts in if you need them.
I find that turning a single-statement if into a {} block when needed is
trivial enough of a change (almost second-nature) to justify keeping
single-statement if's in a nice compact {}-less form (unless the clause or
single-statement is long enough to be broken into multiple lines for
readability). But I'm really compulsive when it comes to code formatting
anyway (everything's gotta be "just so" or I can't focus, kinda like that TV
detective Monk, albiet far less severe ;) ).
More information about the Digitalmars-d
mailing list