bin/71613: [PATCH] traceroute(8): cleanup of the
usr.sbin/traceroute6 code
Dan Lukes
dan at obluda.cz
Sat Mar 15 02:00:07 UTC 2008
The following reply was made to PR bin/71613; it has been noted by GNATS.
From: Dan Lukes <dan at obluda.cz>
To: bruce at cran.org.uk
Cc: bug-followup at freebsd.org
Subject: Re: bin/71613: [PATCH] traceroute(8): cleanup of the usr.sbin/traceroute6
code
Date: Sat, 15 Mar 2008 02:50:12 +0100
bruce at cran.org.uk napsal/wrote, On 03/15/08 02:15:
> I'm not sure 'volatile' is correct in this case - string literals should
> be defined 'const' since they can't be changed.
Content of array of chars can be changed unless defined 'const'. You
can't exceed the size of originally allocated space for such array, of
course. To const or not to const, it is our decision.
To be understand correctly - I'm not against 'const', I'm against
"*since they can't be changed*". This particular string literal should
be defined 'const' *because* it's not changed.
But back to the topic:
> Doing this removes the warning about 'copyright' being unused.
I don't understand what the 'const' has to do with "variable has been
used" so I can't explain why it remove the warning. I'm not sure it's
not an unintentional interference that occur only in (that version of) gcc.
But I may not have sufficient knowledge of C details. If we are sure
the 'const' shall have required effect to "unused" warning by definition
then I have nothing against 'const' way patch.
Dan
More information about the freebsd-bugs
mailing list