Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
coding c++ enum type
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-02-24 (09:09)
From: micha <micha-1@f...>
Subject: coding c++ enum type

when interfacing to c, what is the preferred method to represent enums 
which are used as flags in c?
I can choose between:
1. using a variant type and  a list of those variants to represent the 
or-ed flags. Then I have to iterate over the list to calculate the 
combined flag value.

2. I can export global variables initialized with the real value of the 
flags and a function which combines  (with "or") them together,

Is one method better than the other?