To help LDC/GDC
Manu
turkeyman at gmail.com
Tue Apr 9 01:00:25 PDT 2013
On 9 April 2013 17:54, Dicebot <m.strashun at gmail.com> wrote:
> On Tuesday, 9 April 2013 at 07:52:20 UTC, Manu wrote:
>
>> But that's meaningless though, because there's always the possibility that
>> something somewhere else may have a non-const reference to that thing.
>> Can you suggest a case where const could EVER be used in any sort of
>> optimisation?
>> I don't think const can possibly offer anything to the optimiser in any
>> language, only type safety... I'd love to be wrong.
>>
>
> Don't forget, D variables are thread-local by default. If you get a const
> variable that is not shared or __gshared, compiler can safely assume that
> it will never change in this scope.
>
Errrm, only globals are shared by default.
Locals or allocated memory are not thread-local, can be passed wherever
they want, including other threads.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20130409/6c0e51b2/attachment.html>
More information about the Digitalmars-d
mailing list