This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
Re: [RFC] Notes on QUIT and STREQ et.al.
- To: gdb-patches at sourceware dot cygnus dot com
- Subject: Re: [RFC] Notes on QUIT and STREQ et.al.
- From: Jim Kingdon <kingdon at redhat dot com>
- Date: 13 Mar 2000 08:55:05 -0800
- Newsgroups: cygnus.patches.gdb
- Organization: Cygnus Solutions
- References: <200003131412.PAA16094@landau.wins.uva.nl>
> 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).