C const

simendsjo simen.endsjo at pandavre.com
Fri Mar 4 15:20:06 PST 2011


On 04.03.2011 23:10, Jesse Phillips wrote:
> 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.

Thanks. Does this apply to all uses of const, or just complex members?


More information about the Digitalmars-d-learn mailing list