scope(exit) without exception handling?

Steven Schveighoffer schveiguy at yahoo.com
Wed May 16 10:43:26 PDT 2012


On Wed, 16 May 2012 13:19:01 -0400, David Nadlinger <see at klickverbot.at>  
wrote:

> On Wednesday, 16 May 2012 at 13:10:05 UTC, Steven Schveighoffer wrote:
>> I don't see exception handling in the generated code (at least I don't  
>> see the _d_local_unwind2), I wonder a) if this is more efficient than  
>> scope(exit), and b) if so, why can't the compiler do this automatically?
>
> I think you might be misreading the assembly – which operating system  
> are you on? You can only expect to see _d_local_unwind on Windows, Dwarf  
> EH is implemented differently.

OK, that probably explains it :)

> In the first case, where the code can't throw, the exception handling  
> code is probably not generated at all.

Yes, I see that the compiler likely does the right thing, and I just  
implemented a totally useless feature in the face of scope(exit) :)

I was kind of curious though, if it would work!

-Steve


More information about the Digitalmars-d mailing list