This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: C++ PATCH to fix thinko
On Mon, May 15, 2000 at 08:44:50PM +0200, Gabriel Dos Reis wrote:
> Manfred Hollstein <manfred.h@gmx.net> writes:
>
> | I believe, using constants as the length argument to strncmp
> | is error prone; I'd suggest to use this instead:
> |
> | else if (!strncmp (p, "diagnostics-show-location=",
> | sizeof ("diagnostics-show-location=") - 1))
>
> 100% agreed.
I like to go a bit farther:
#define DSC(str) str, sizeof(str) - 1
else if (!strncmp (p, DSC("diagnostics-show-location-")))
which makes it impossible to mistype the string in one place, or
forget the - 1.
zw