[Bro-Dev] enums in modules

Gregor Maier gregor at icir.org
Mon Jan 24 11:56:12 PST 2011


On 1/24/11 11:50 , Seth Hall wrote:
> 
> On Jan 24, 2011, at 11:31 AM, Robin Sommer wrote:
> 
>>
>> On Sun, Jan 23, 2011 at 01:21 -0500, you wrote:
>>
>>> I think that does work, it's the namespacing that messes things up
>>> because the Bro and C syntaxes don't mesh.  Maybe bifcl could munge
>>> namespaces from Logging::ID to _Logging__ID or something to provide
>>> the transition?
>>
>> I'd need to look closer at bifcl. Can you file a ticket with a small
>> example demonstrating the problem? Thanks,
> 
> 
> After taking a deeper look into this, I realized that I may be misunderstanding how enums are supposed to be used.  Does it make sense that you'd provide an enum name as a type to get static type checking?  Like this...
> 
> <code example>
> type TEST_ENUM: enum { test_one, test_two, test_three };
> 
> function blah(b: TEST_ENUM)
> 	{
> 	print "did it work?";
> 	}
> 
> event bro_init()
> 	{
> 	local a = test_two;
> 	print blah(a);
> 	}
> </code example>
> 
> I get this error from that code..
> 
> [seth at Blake build (master)]$ ./src/bro test.bro 
> ./test.bro, line 11 (print blah(a)): error, value of type void illegal

blah() doesn't return anything, so you can't print it....



cu
Gregor
-- 
Gregor Maier
<gregor at icir.org>  <gregor at icsi.berkeley.edu>
Int. Computer Science Institute (ICSI)
1947 Center St., Ste. 600
Berkeley, CA 94704, USA
http://www.icir.org/gregor/


More information about the bro-dev mailing list