enum egprs_puncturing_values

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/osmocom-net-gprs@lists.osmocom.org/.

Jacob jacob01 at gmx.net
Fri Dec 16 14:05:35 UTC 2016


Hi Neels,

On 12/16/2016 12:57 PM, Neels Hofmeyr wrote:
> On Thu, Dec 15, 2016 at 02:36:23PM +0100, Jacob wrote:

> 
> I thought negative values in enums are fine? What could be a problem here?
> e.g.
> 
>   enum my_vals {
>   	MY_VAL_INVALID = -1,
> 	MY_VAL_A = 0,
> 	MY_VAL_B,
> 	MY_VAL_C,		
>   };

I checked that with C99 and you are right. According to §6.7.2.2 (4) the
compiler must use a signed type for the enum if at least one constant is
a valid negative int. Nevertheless I had some issues with assigning -1
to an enum some time ago, but it might well be that there was no
negative constant involved and I went into some implicit signed/unsigned
conversion hell with differing enum bit sizes or something like that.

Sorry for the noise.

Jacob




> 
> ~N
> 



More information about the osmocom-net-gprs mailing list