scope(exit) and Ctrl-C

codephantom me at noyb.com
Sat Dec 2 05:00:29 UTC 2017


On Saturday, 2 December 2017 at 04:28:57 UTC, Wanderer wrote:
> Thanks! This works. But it seems a little bit suspicions that 
> D's type for handler function has `nothrow` `@nogc` and 
> `@system`. I wonder why is that?

During execution of that handler, it make sense to prohibit the 
allocation of any GC memory, and prohibit the throwing of any 
exceptions. I presume that's why they're there (??)

@system is default

(btw, change -1 to 1 in the exit function, i.e. -1 is not valid, 
0..255 is valid.. but some of those you should avoid using).



More information about the Digitalmars-d-learn mailing list