Translating C const

Jacob Carlborg doob at me.com
Wed May 16 01:24:55 PDT 2012


On 2012-05-16 09:00, Jonathan M Davis wrote:

> Probably true. But also, if you're talking about a const pointer to a mutable
> value, the constness of the pointer is actually irrelevant to the caller. The
> pointer will be copied when the function is called, so it doesn't matter on
> whit whether the pointer itself is const or not. What matters is whether
> what's being pointed to is const or not. So, if you have a function which
> takes a const pointer to a non-const value, then that's essentially identical
> to one that takes a non-const pointer to a non-const value as far as the
> declarations go - and for declaring extern(C) functions for use in D, that's
> generally all you care about.
>
> - Jonathan M Davis

Ok I see, thanks. Is that true for fields in structs and global 
variables as well?

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list