lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [lwip-users] Strange "always true" conditional in tcp_in.c


From: Kieran Mansley
Subject: RE: [lwip-users] Strange "always true" conditional in tcp_in.c
Date: Mon, 01 Mar 2010 14:21:22 +0000

On Mon, 2010-03-01 at 08:49 -0500, Bill Auerbach wrote:

> You could assign a variable max_dupacks of the same type as dupacks to -1UL
> which would store the maximum unsigned value and then do:
> 
> if (pcb->dupacks != max_dupacks)
>   ++pcb->dupacks;

This sounds like the best solution as max_dupacks can be defined
adjacent to the definition of dupacks, and so if one is changed it is
obvious the other needs to be too.

I wonder if there are other similar cases lurking in the code that we
also need to fix.  Perhaps the original poster (John Carter) whose
compiler was warning about this could make a list and file a bug report?

> C lacks the much needed compile time access to type information to allow
> programs to enforce certain types and/or the signedness of types.

It's true that there are lots of languages that would not have this sort
of subtle bug.  I wonder if we should re-write lwIP in OCaml? ;)

Kieran





reply via email to

[Prev in Thread] Current Thread [Next in Thread]