Re: GHashTable and const
- From: "Morten Welinder" <mwelinder gmail com>
- To: "Andrew W. Nosenko" <andrew w nosenko gmail com>
- Cc: gtk-devel-list gnome org, Ross Burton <ross burtonini com>
- Subject: Re: GHashTable and const
- Date: Thu, 3 Jul 2008 09:21:42 -0400
>> 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]