caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* C-like macros in OCaml
@ 2007-06-26 22:00 Raj B
  2007-06-26 22:06 ` [Caml-list] " Jonathan Bryant
  2007-06-27  4:10 ` Richard Jones
  0 siblings, 2 replies; 8+ messages in thread
From: Raj B @ 2007-06-26 22:00 UTC (permalink / raw)
  To: caml-list

Hi there

Is there any way I can achieve the use of C-like preprocessor macros  
in OCaml?
i.e.

#define FOO 1

etc.

I am using an array of bits (a bitset) where each bit represents a  
flag, and i would like to
access this set by using names rather than remembering which index in  
the array represents which flag.

Similarly, is there any way of getting a C-like enumeration? e.g.

enum days {Mon = 1, Tue, Wed...}

I guess that OCaml does not provide these by default, but I wonder if  
someone has done some camlp4 magic
to use these.

Thanks
Raj


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2007-06-28  7:44 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20070627044609.6B456BC77@yquem.inria.fr>
2007-06-27  7:21 ` [Caml-list] C-like macros in OCaml David Allsopp
2007-06-26 22:00 Raj B
2007-06-26 22:06 ` [Caml-list] " Jonathan Bryant
2007-06-27  4:10 ` Richard Jones
2007-06-27  7:43   ` Jeremy Yallop
2007-06-27  8:08     ` Loup Vaillant
2007-06-27 12:53       ` Christopher L Conway
     [not found]         ` <6f9f8f4a0706280037h5f19af5flb764e1c2999b0337@mail.gmail.com>
2007-06-28  7:38           ` Loup Vaillant
2007-06-28  7:44         ` Nicolas Pouillard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).