[cffi-devel] defenum proposal

efuzzyone at netscape.net efuzzyone at netscape.net
Tue Jan 24 06:42:12 UTC 2006


Hello,
   Another concern of the original post was how to handle anonymous C 
enums in cffi.

Should one use `defconstants' for them? Or should cffi provide a 
mechanism to declare anonymous enums?

As per my understanding cffi requires all enums to be named.

Thanks.
--
Surendra Singhi
http://ssinghi.kreeti.com/


-----Original Message-----
From: Luís Oliveira <luismbo at gmail.com>
To: Frank Buss <fb at frank-buss.de>
Cc: cffi-devel at common-lisp.net; justinhj at gmail.com; 'Surendra Singhi' 
<EFuzzyONE at netscape.net>
Sent: Sun, 22 Jan 2006 15:56:45 +0000
Subject: Re: [cffi-devel] defenum proposal

  On 2006-jan-22, at 14:47, Frank Buss wrote:
  > It is not necessary to use keywords like for the named enums, 
because
  > unnamed enums in C are just syntatic sugar for a list of > 
"#define"s, which
  > is mapped to a list of defconstants. I don't know, if this macro > 
fits in the
  > philosophy of CFFI, perhaps in some utility class, and maybe with > 
another
 > name "defanonenum".

  I don't really think of C's enum that way. If I want constants, I use 
#define (and defconstant in CL). If I want to represent some sort of 
entity or concept I use an enum (and symbols in CL). For example:

 #define MAX_COUNT 127

 (defconstant +max-count+ 127)

 vs.

 enum {
 RED,
 BLUE
 };

 :red, :blue (or 'red, 'blue)

 I suppose defcenum shouldn't force the user to use keywords though?

 --Luís Oliveira
 http://student.dei.uc.pt/~lmoliv/
 Equipa Portuguesa do Translation Project
 http://www.iro.umontreal.ca/translation/registry.cgi?team=pt


___________________________________________________
Try the New Netscape Mail Today!
Virtually Spam-Free | More Storage | Import Your Contact List
http://mail.netscape.com



More information about the cffi-devel mailing list