[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Fri, 03 Apr 2009 16:10:07 +0200
Reuben Thomas wrote:
> Why is this rule valid? GCC gives warnings if const pointers are not
> cast to non-const before passing to C. As far as I can see, this is
> correct: free takes a non-const argument.
> Should malloced memory
> simply not be assigned to a const pointer?
In the scope that frees pointer P, P should not have the "const"
attribute, since the "const" attribute implies you will not modify
anything through P, and free may do that.