Cleaned up C++

John Colvin via Digitalmars-d digitalmars-d at puremagic.com
Thu Apr 23 07:50:25 PDT 2015


On Thursday, 23 April 2015 at 14:29:01 UTC, Ola Fosheim Grøstad 
wrote:
>>Can you give a specific example where all 3 points are
>> satisfied?
>
> Not sure why you would need it, plenty of cases where compilers 
> will fail. E.g. queues between threads (like real time threads) 
> where you allocate in one thread and fill out data in another 
> thread.
>
> Any preallocation done on large data structures or frequently 
> reinitialized data structures may perform better without 
> explicit initialization.

Yes, there are times the compiler can't optimise the dead stores 
away. Obviously these dead stores are not free. What I don't see 
is a good example of when that cost matters.

There are cases where you might really need to grab an extra 
1-5%, at which point you are hand optimising and = void is a 
reasonable tool.


More information about the Digitalmars-d mailing list