buglwIP - A Lightweight TCP/IP stack - Bugs: bug #28551, Compiler warning introduced with...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #28551: Compiler warning introduced with closed bug #28506

Submitted by:  Iordan Neshev <iordan_neshev>
Submitted on:  Mon 11 Jan 2010 08:59:26 AM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: Compiler WarningStatus: Fixed
Privacy: PublicAssigned to: Simon Goldschmidt <goldsimon>
Open/Closed: ClosedPlanned Release: None
lwIP version: CVS Head

Mon 11 Jan 2010 04:36:32 PM UTC, comment #5:

> I've never tried to remember the priority of logical operations


Me neither, and it hit me ;-)

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Mon 11 Jan 2010 02:47:51 PM UTC, comment #4:

Bill, I've never tried to remember the priority of logical operations, so I always place braces, even when they are not actually needed. That's why I wrote the two possible cases without thinking what the code was supposed to do :)

Iordan Neshev <iordan_neshev>
Mon 11 Jan 2010 02:24:25 PM UTC, comment #3:

In this case, the warning was correct as the code as it was before was not what I wanted: (A && (B || C)) is correct, ((A && B) || C) not - only check the IP address if proto is the same, in this case).

> When warning levels are cranked all the way up for a given
> compiler, are you going to make changes to suppress all of the
> additional warnings?


Not always, but many warnings make sense and may easily be avoided. Personally, I'm compiling with warnings==errors, but that's for projects with one compiler, so saying "I'll suppress all warnings for any compiler" is not what I want.

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Mon 11 Jan 2010 02:12:01 PM UTC, comment #2:

I'm surprised you're offered (A && (B || C)) as a choice, since it's not a comparable replacement. (A && B || C) is the same as ((A && B) || C).

Simon, the result of the 'if' has changed with this patch. The B || C is now parenthesized. Is that what you want?

I've never liked this warning. Why not a warning on x = a + b * c;? What's the difference?

When warning levels are cranked all the way up for a given compiler, are you going to make changes to suppress all of the additional warnings?

Bill Auerbach <billauerbach>
Mon 11 Jan 2010 09:51:56 AM UTC, comment #1:

Fixed, thanks. That's what happens when compiling with visual studio :-(

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Mon 11 Jan 2010 08:59:26 AM UTC, original submission:

I get a compiler warning for the if() on line 95:
"Suggest parentheses around && with ||"

Currently the condition is:
(A && B || C)
The compiler suggests it to be either
((A && B) || C) or
(A && (B || C))

Iordan Neshev <iordan_neshev>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by billauerbach (Posted a comment)
  • -unavailable- added by goldsimon (Posted a comment)
  • -unavailable- added by iordan_neshev (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 11 Jan 2010 09:51:56 AM UTCgoldsimonStatusNone=>Fixed
      Assigned toNone=>goldsimon
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1