public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* The perils of strcmp_iw
@ 2003-02-09  3:59 Daniel Jacobowitz
  2003-02-11 22:04 ` David Carlton
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Jacobowitz @ 2003-02-09  3:59 UTC (permalink / raw)
  To: gdb

minsyms.c:minsym_hash_iw has:
/* Compute a hash code based using the same criteria as `strcmp_iw'.  */

But actually it doesn't.  strcmp_iw has the property of "foo == foo(arg)";
minsym_hash_iw has the stronger property of stops-at-first-left-parenthesis.
Suppose that we have something like "foo::operator()", or the horrific
"int foo<&(bar())>()" [yes, that's a real mangled name.  No, I'm not
immediately sure why the return type is included.  I suspect this drives our
current code absolutely wild.]

This is mostly a disgusted note to myself to clean up the comments; the hash
function is weaker than the equality test (terminology?), so we're OK.  The
equality test has the potential for spurious matches but only if they have
unbalanced parens in them, so I'm not concerned right now.  I just happened
to notice this while working on something else.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: The perils of strcmp_iw
  2003-02-09  3:59 The perils of strcmp_iw Daniel Jacobowitz
@ 2003-02-11 22:04 ` David Carlton
  2003-02-17 14:58   ` Andrew Cagney
  0 siblings, 1 reply; 4+ messages in thread
From: David Carlton @ 2003-02-11 22:04 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb

On Sat, 8 Feb 2003 22:59:19 -0500, Daniel Jacobowitz <drow@mvista.com> said:

> strcmp_iw has the property of "foo == foo(arg)";

You doubtless know this already, but actually strcmp_iw doesn't have
that property: it has the property "foo(arg) == foo".  Or, rather,
"foo(ANYTHING == foo", where ANYTHING doesn't have to end in a right
parenthesis.  So strcmp_iw not only doesn't do clever parenthesis
checking, but it isn't even symmetric.

(And, of course, it's also unlike strcmp in another way, namely that
you can't use it to do sorting.)

Sigh.  Still, it works pretty well, once you know its quirks.

David Carlton
carlton@math.stanford.edu

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: The perils of strcmp_iw
  2003-02-11 22:04 ` David Carlton
@ 2003-02-17 14:58   ` Andrew Cagney
  2003-02-20 22:35     ` David Carlton
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Cagney @ 2003-02-17 14:58 UTC (permalink / raw)
  To: David Carlton; +Cc: Daniel Jacobowitz, gdb

> On Sat, 8 Feb 2003 22:59:19 -0500, Daniel Jacobowitz <drow@mvista.com> said:
> 
> 
>> strcmp_iw has the property of "foo == foo(arg)";
> 
> 
> You doubtless know this already, but actually strcmp_iw doesn't have
> that property: it has the property "foo(arg) == foo".  Or, rather,
> "foo(ANYTHING == foo", where ANYTHING doesn't have to end in a right
> parenthesis.  So strcmp_iw not only doesn't do clever parenthesis
> checking, but it isn't even symmetric.
> 
> (And, of course, it's also unlike strcmp in another way, namely that
> you can't use it to do sorting.)
> 
> Sigh.  Still, it works pretty well, once you know its quirks.

Sounds like it could do with a better name.

Andrew


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: The perils of strcmp_iw
  2003-02-17 14:58   ` Andrew Cagney
@ 2003-02-20 22:35     ` David Carlton
  0 siblings, 0 replies; 4+ messages in thread
From: David Carlton @ 2003-02-20 22:35 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: Daniel Jacobowitz, gdb

On Sun, 16 Feb 2003 10:24:02 +0100, Andrew Cagney <ac131313@redhat.com> said:

[responding to my discussion of the quirks of strcmp_iw]

> Sounds like it could do with a better name.

Yes, that would be a good idea.  Fortunately, many of its uses are
buried within the macro SYMBOL_MATCHES_NAME, but it would still
probably be better if the name were changed.

David Carlton
carlton@math.stanford.edu

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-02-20 22:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-09  3:59 The perils of strcmp_iw Daniel Jacobowitz
2003-02-11 22:04 ` David Carlton
2003-02-17 14:58   ` Andrew Cagney
2003-02-20 22:35     ` David Carlton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).