[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-devel] PPP LCP Phases Not Enum in 2.0.0 Beta
From: |
Sylvain Rochet |
Subject: |
Re: [lwip-devel] PPP LCP Phases Not Enum in 2.0.0 Beta |
Date: |
Tue, 2 Aug 2016 00:22:11 +0200 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
Hi Greg,
On Mon, Aug 01, 2016 at 09:50:30PM +0000, Greg Smith wrote:
> Hello.
>
> In Lwip 1.4.1, the PPP LCP states (phases) were all defined as an enum
> (typedef LinkPhase). This made seeing the state in a debugger really
> nice -- it would show "PHASE_DEAD", for example. In 2.0.0 Beta1, they
> have been converted to #define macros. Now the debugger only shows a
> number (0, for example), which isn't as convenient.
>
> So:
>
> 1) I'd like to understand why this change was made.
In C, an enum type is always an int, which is a 4-byte value on 32-bit
systems (also 4-byte on LP64, LLP64, and 8-byte on ILP64, but we are a
bit outside lwIP targets here). So this is to save 3 (or 7) bytes of RAM
per state value, and it matters.
If you look closely, you will see that lwIP avoid (or is never?) using
enum type in storage type because of that.
For the enum vs #define list declaration choice, that's only a cosmetic
question then, pppd is using #define list so I just followed.
> 2) Barring a compelling argument above, I'd like to ask if this could
> go back to an enumerated type.
>
> 3) And likewise, could other state information, like the PPPERR_*
> macros, link states (PPP_FSM_*), etc. be changed to enums for the same
> debugging purpose?
For the reason explained above, no :-)
Sylvain
signature.asc
Description: Digital signature
- [lwip-devel] PPP LCP Phases Not Enum in 2.0.0 Beta, Greg Smith, 2016/08/01
- Re: [lwip-devel] PPP LCP Phases Not Enum in 2.0.0 Beta,
Sylvain Rochet <=
- Re: [lwip-devel] PPP LCP Phases Not Enum in 2.0.0 Beta, Sylvain Rochet, 2016/08/01
- Re: [lwip-devel] PPP LCP Phases Not Enum in 2.0.0 Beta, Sylvain Rochet, 2016/08/01
- Re: [lwip-devel] PPP LCP Phases Not Enum in 2.0.0 Beta, Simon Goldschmidt, 2016/08/02
- Re: [lwip-devel] PPP LCP Phases Not Enum in 2.0.0 Beta, Greg Smith, 2016/08/02
- Re: [lwip-devel] PPP LCP Phases Not Enum in 2.0.0 Beta, Greg Smith, 2016/08/02
- Re: [lwip-devel] PPP LCP Phases Not Enum in 2.0.0 Beta, Greg Smith, 2016/08/03
- Re: [lwip-devel] PPP LCP Phases Not Enum in 2.0.0 Beta, address@hidden, 2016/08/03
- Re: [lwip-devel] PPP LCP Phases Not Enum in 2.0.0 Beta, Sylvain Rochet, 2016/08/04