[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: lynx-dev The whole CTRACE thing
From: |
Gisle Vanem |
Subject: |
Re: lynx-dev The whole CTRACE thing |
Date: |
Mon, 19 Apr 1999 12:26:17 +0200 (CEST) |
John Bley <address@hidden> said:
> Again, not advocating doing anything drastic for 2.8.2, but I do think
> CTRACE needs to be replaced eventually. Here's why:
> CTRACE(...);
> if (TRACE) fprintf(...);
> ^^^^^^ literal text from the original line
>
> So what happens with this?
> if (warning_cond) /* Note lack of {}s */
> CTRACE(... "Warning: blah blah");
> else
> do_safe_stuff();
>
> becomes (to the compiler):
>
> if(warning_cond)
> if (TRACE) fprintf(... "Warning: blah blah");
> else /* bound to the if (TRACE), not the if (warning_cond) */
> do_safe_stuff();
That's easy to fix:
#define CTRACE(arg) do { \
if (TRACE) \
fprintf arg; \
} while (0)
However, this requires extra paranthesis:
CTRACE ((tfp, "foo"));
Gisle V.