Any pointers on what's going on here?
% cat Map.vala
using Gee;
static int main( string[] args )
{
var map = new HashMap<string, string>();
map.set( "hello", "hej" );
map.set( "good bye", "hej då" );
foreach( string key in map.get_keys() ) stdout.printf( "Key: %s\n", key );
foreach( string val in map.get_values() ) stdout.printf( "Value: %s\n",
val );
foreach( string key in map.get_keys() ) stdout.printf( "Key: %s - Val:
%s\n", key, map.get( key ));
return( 0 );
}
% valac --pkg gee-1.0 Map.vala
% ./Map
Key: hello
Key: good bye
Value: hej
Value: hej då
Key: hello - Val: (null)
Key: good bye - Val: (null)
Switching to using TreeMap instead results in the following:
% valac --pkg gee-1.0 Map.vala
/home/magnus/devo/test/vala/TestGee/Map.vala.c: In function ‘_main’:
/home/magnus/devo/test/vala/TestGee/Map.vala.c:21: warning: passing argument 7
of ‘gee_tree_map_new’ from incompatible pointer type
/usr/include/gee-1.0/gee.h:584: note: expected ‘GCompareFunc’ but argument is
of type ‘gint (*)(void *, void *)’
And a segmentation fault at runtime. Not quite what I had expected... % valac --version Vala 0.7.6 % pacman -Q libgee libgee 0.3.0-1 /M -- Magnus Therning (OpenPGP: 0xAB4DFBA4) magnus@therning.org Jabber: magnus@therning.org http://therning.org/magnus identi.ca|twitter: magthe
Attachment:
signature.asc
Description: OpenPGP digital signature