--- layout: fc_discuss_archives title: Message 82 from Frama-C-discuss on April 2009 ---
[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