Web lists-archives.org

Re: GHashTable and const




>> Because const in C is crippled, unlike in C++ where its actually useful.
>>
>
> Soory, but you aren't right:

Yes, he is, but you did not understand him.  He was making a language
comment, not an implementation comment.

"const" in C does not propagate as usefully as you would like.  Therefore,
the following sniplet is not violating C rules:

struct Foo { int *x; };
int foo (const struct Foo *p) { *(p->x) = 1; }

While I cannot change p->x, I can change what
That said, it still wouldn't hurt to add const for cases like g_hash_table_size.

Morten
_______________________________________________
gtk-devel-list mailing list
gtk-devel-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-devel-list