C const

Jesse Phillips jessekphillips+D at gmail.com
Fri Mar 4 14:10:45 PST 2011


simendsjo Wrote:

> So all const modifiers should be dropped everywhere..?
> 
> And should the const be dropped here?
> struct somestruct {
>    const struct otherstruct;
> }

All in all the real answer comes down to, is the data modified. Since C makes no guarantees you must only declare things const if you know the library will abide by it. In the case above I think you have to drop it.

Remember that const/immutable, and other attributes/properties aren't going to change the ABI so dropping them will be safer then leaving them.


More information about the Digitalmars-d-learn mailing list