This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: Avoid signed/unsigned warnings in tc-arm.c


Zack Weinberg writes:
 > 2) Say what happened, not why.  In this case, a correct change log would read
 > 
 > 	* tc-arm.c [...]

I would augment this comment by adding that explanations of
why are still ok (if warranted), but if they're warranted they usually
belong with the code and not the changelog.

This comes from
http://www.gnu.org/software/guile/changelogs/guile-changelogs_3.html:
[but this was copied many years ago, no doubt it's moved or changed
since then]:

One should never need the ChangeLog to understand the current
code. If you find yourself writing a significant explanation in the
ChangeLog, you should consider carefully whether your text doesn't
actually belong in a comment, alongside the code it explains. Here's an
example of doing it right: 

1999-02-23  Tom Tromey  address@removed

      * cplus-dem.c (consume_count): If `count' is unreasonable,
        return 0 and don't advance input pointer.

And then, in `consume_count' in `cplus-dem.c': 

   while (isdigit ((unsigned char)**type))
     {
       count *= 10;
       count += **type - '0';
       /* A sanity check.  Otherwise a symbol like
         `_Utf390_1__1_9223372036854775807__9223372036854775'
         can cause this function to return a negative value.
         In this case we just consume until the end of the string.  */
      if (count > strlen (*type))
        {
          *type = save;
          return 0;
	}
     }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]