[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-devel] [bug #35875] #define ⇒ enum?
From: |
Bill Auerbach |
Subject: |
Re: [lwip-devel] [bug #35875] #define ⇒ enum? |
Date: |
Mon, 19 Mar 2012 17:42:07 -0400 |
>-----Original Message-----
>From: address@hidden
>[mailto:address@hidden On
>Behalf Of David Empson
>Sent: Monday, March 19, 2012 5:18 PM
>To: lwip-devel
>Subject: Re: [lwip-devel] [bug #35875] #define ⇒ enum?
>
>One argument against using enums (admittedly weak): some compilers,
>including one we are using, implement enums as unsigned instead of
>signed integers, in violation of C standards. Attempting to declare a
>negative enum value produces an error. I generally prefer to use enums
>for named constants, but with this compiler I've had to use #define for
>negative values.
David,
You mean this is an error:
enum someEnum { Val1 = 1, Val2 = -1 };
What about:
enum someEnum { Val1 = 1, Val2 = -1U };
or
enum someEnum { Val1 = 1, Val2 = (unsigned) -1 };
That reall is an odd thing for a compiler - I could see using unsigned if no
member is < 0 but to default to unsigned isn't good. And it's really easy
to resolve if the compiler is still being maintained.
Bill
- [lwip-devel] [bug #35875] #define ⇒ enum?, Markus Elfring, 2012/03/17
- [lwip-devel] [bug #35875] #define ⇒ enum?, Simon Goldschmidt, 2012/03/18
- Re: [lwip-devel] [bug #35875] #define ⇒ enum?, David Brown, 2012/03/19
- Re: [lwip-devel] [bug #35875] #define ⇒ enum?, Bill Auerbach, 2012/03/19
- Re: [lwip-devel] [bug #35875] #define ⇒ enum?, David Brown, 2012/03/19
- Re: [lwip-devel] [bug #35875] #define ⇒ enum?, Simon Goldschmidt, 2012/03/19
- Re: [lwip-devel] [bug #35875] #define ⇒ enum?, David Empson, 2012/03/19
- Re: [lwip-devel] [bug #35875] #define ⇒ enum?,
Bill Auerbach <=
- Re: [lwip-devel] [bug #35875] #define ⇒ enum?, David Empson, 2012/03/20
- Re: [lwip-devel] [bug #35875] #define ⇒ enum?, Bill Auerbach, 2012/03/19
[lwip-devel] [bug #35875] #define ⇒ enum?, Kieran Mansley, 2012/03/20