Rvalue references - The resolution

Tove tove at fransson.se
Sat May 4 12:40:35 PDT 2013


On Saturday, 4 May 2013 at 18:33:04 UTC, Walter Bright wrote:
> Runtime Detection
>
> There are still a few cases that the compiler cannot statically 
> detect. For these a runtime check is inserted, which compares 
> the returned ref pointer to see if it lies within the stack 
> frame of the exiting function, and if it does, halts the 
> program. The cost will be a couple of CMP instructions and an 
> LEA. These checks would be omitted if the -noboundscheck 
> compiler switch was provided.

Thanks for taking the time to detail the solution, I was quite 
curious.

Runtime Detection and opt-out with "-noboundscheck" is a stroke 
of genius!

"couple of CMP instructions"
should be possible to reduce to only one with the "normal" 
unsigned range check idiom, no?

Looking forwards to hear more cool news. :)


More information about the Digitalmars-d mailing list