lwip-devel
[Top][All Lists]
Advanced

[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: Simon Goldschmidt
Subject: Re: [lwip-devel] PPP LCP Phases Not Enum in 2.0.0 Beta
Date: Tue, 2 Aug 2016 07:45:24 +0200

Sylvain Rochet wrote:
> If you look closely, you will see that lwIP avoid (or is never?) using 
> enum type in storage type because of that.

I thought so, too, but remembered at least tcp_state being an enum (and this
is indeed very convenient for debugging). However, there are some other enums
used. This is OK as long as they are not stored but passed as arguments/return
values only. Looks like we have some cleaning up to do there...

> I'm not sure this is widely supported though... even with #pragma for
> pragma-based compilers (erk!) in the same way we are doing for struct.

I havent' seen that, I'll have to check my 2 ugly pragma-based compilers (MSVC
and IAR)...

> The benefit is close to zero in my opinion so that's probably not even
> worth trying.

Actually, I think it's sometimes really annoying to not have the enum info:
looking up the enum value in the debugger can really be time consuming depending
on what you are debugging. I wouldd be happy if we could find a fix for this,
only I don't know a portable one.

Maybe we could separate the enum vs. typedef creation and make the typedef
creation use a define which is overridable?

enum toto {
TOTO,
TITI
};
LWIP_ENUMTYPEDEF(enum toto, toto_t);

which would result in 'typedef u8_t toto_t' by default but could be overridable
to 'typedef enum toto toto_t'? Although I guess that doesn't cover the gcc 
attribute
case...

In any way, I'm aware this hurts when debugging but as Sylvain explained, C is
not really good at saving RAM here (although some compilers are).


Simon



reply via email to

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