[RFA] gdbserver/server.c: Replace 2x strlen() by a variable
Joel Brobecker
brobecker@adacore.com
Thu Dec 21 13:04:00 GMT 2006
> > Actually, since the same string is duplicated a couple of times,
> > I would also suggest declaring a constant string "QPassSignals:"
> > and use the constant instead of risking a typo... How about:
> >
> > const char str[] = "QPassSignals:";
> >
> > and then use "sizeof (str) - 1". Is that bad coding style? Otherwise,
> > you can declare your sale constant:
> >
> > const int len = strlen (str);
> >
> > I am not reviewer, so these are just suggestions, not a request (JIC).
>
> I'm pretty sure GCC will optimize away the strlen("QPassSignals:") anyway,
> so we really shouldn't try to obfuscate the code just to make it a bit
> faster. So if optimization was the Markus' argument for making this
> change I object to this change.
How about avoiding the string duplication? Do you object to that too?
This change seems like a good idea to me - although I agree that the
risks of inconsistency are very small...
--
Joel
More information about the Gdb-patches
mailing list