coding

Bryan O'Sullivan bos at serpentine.com
Tue Sep 2 15:55:00 CEST 2003


On Tue, 2003-09-02 at 12:57, Greg Watson wrote:

> I think they work well when you have a sequence of numbers like this, 
> but I would rather see each enum explicitly given it's value as in:
> 
> enum {
>   FLOPPY_DEVICE=0,
>   PARALLEL_DEVICE=1,
>   COM2_DEVICE=2,
>   COM1_DEVICE=3,
>   SWC_DEVICE=4,
>   MOUSE_DEVICE=5,
>   KBC_DEVICE=6,
>   GPIO_DEVICE=7,
>   ACB_DEVICE=8,
>   FSCM_DEVICE=9,
>   WDT_DEVICE=10
> };
> 
> Otherwise you're forever trying to work out what the actual value is.

More importantly, this style reduces the likelihood of screwing up the
ABI by adding an enum member somewhere other than the end of the list.

	<b




More information about the coreboot mailing list