This is the mail archive of the binutils@sourceware.org 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: Software Quality Binutils


On Tue, Aug 14, 2018 at 8:22 AM, Paul Koning <paulkoning@comcast.net> wrote:

>
>
> > On Aug 14, 2018, at 7:12 AM, John Darrington <
> john@darrington.wattle.id.au> wrote:
> >
> > ...
> > I think it's flagging things like:
> >
> > if (cond)
> > {
> >  do_this ();
> >  do_that ();
> > }
> > else
> > {
> >  do_this ();
> > }
> >
> > ... which it wants changed to:
> >
> > do_this ();
> > if (cond)
> > do_that ();
> >
> >
> > which of-course has the same effect iff evaluating cond does not
> > have side effects.
>
> Not so; if do_this() may change cond, then the two are semantically
> different.
>

When looking at static analyzer output for RTEMS, we took places like this
as a suggestion that either this change is a nice idea or we need a comment
to indicate that cond could actually change as a side-effect. We don't
someone
to be tempted if it is dangerous or wrong.

Is this Sonar the same as GrammaTech CodeSonar?

--joel


>
>         paul
>
>


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