Frama-C-discuss mailing list archives

This page gathers the archives of the old Frama-C-discuss archives, that was hosted by Inria's gforge before its demise at the end of 2020. To search for mails newer than September 2020, please visit the page of the new mailing list on Renater.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Frama-c-discuss] Enum in cil



David RIBEIRO CAMPELO wrote :
> For example :
> 
> // Declaration of the enum:
> typedef enum { left, middle, right,NB_side } side;
> // Use of enum:
> enum side t = left;

I think the problem comes from a little error in your source code.
By the way, you have an hint if you try to compile it..
 > gcc enum.c
enum.c:4: error: variable 't' has initializer but incomplete type

The reason is that :

typedef enum { left, middle, right,NB_side } side;

is a short cut for :

enum an_enum_name { left, middle, right,NB_side };
typedef enum an_enum_name side;

Then, your have two names for the type :
(enum an_enum_name) or side
but not : enum side
that you used in the declaration of the variable t.

Hope this help.
-- 
Anne Pacalet  -
INRIA - 2004, route des Lucioles BP.93 F-06902 Sophia Antipolis Cedex.
Tel : +33 (0) 4 9715 5345