[RFC] Notes on QUIT and STREQ et.al.
Jim Kingdon
kingdon@redhat.com
Mon Mar 13 09:15:00 GMT 2000
> Well, STRCMP really doesn't make any sense. A decent compiler in
> combination with appropriate headers will take care of the
> optimization.
I agree. Trying to second-guess the compiler/library might even be
slower (not that I've done any benchmarking, mind you, just that I
have a hunch that comparing the first word rather than the first byte
might be a win on some architectures/situations).
> I'm not sure if we want STREQ to go. I think that `STREQ (a, b)' is
> both easier to read and easier to type than `strcmp (a, b) == 0'.
Well, perhaps it is because I have gotten used to the strcmp == 0
idiom, but I find it to be pretty annoying to have to look up a macro
like this (sure, it _probably_ is defined in the obvious way, but you
don't know that for sure when digging into a new program). Granted
strcmp == 0 is hard to understand until/unless you know the standard C
library well enough for it to be second nature.
As for QUIT, I agree that it should be possible to be a function. If
the functional call overhead ends up mattering, it is being called too
often (for one thing, the test of quit_flag and interactive_flag are
also going to slow things down unnecessarily).
More information about the Gdb-patches
mailing list