April 14, 2005 Exceptions part 3: Auto objects | ||||
---|---|---|---|---|
| ||||
# /* # This example demonstrates that auto objects that are part # of an inheritance heirarchy are not destroyed on scope exit. # */ # auto class AutoTest # { # # } # # auto class AutoTest1 : AutoTest # { # this() # { # printf( "AutoTest1 ctor\n" ); # } # # ~this() # { # printf( "AutoTest1 dtor\n" ); # } # } # # # void main() # { # try # { # auto AutoTest a = new AutoTest1(); # } # catch( Exception e ) # { # printf( "fail: %.*s\n", e.toString() ); # } # fullCollect(); # printf( "done\n" ); # } Output: AutoTest1 ctor done AutoTest1 dtor |
April 15, 2005 Re: Exceptions part 3: Auto objects | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sean Kelly | -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Sean Kelly schrieb am Thu, 14 Apr 2005 05:40:19 +0000 (UTC): > # /* > # This example demonstrates that auto objects that are part > # of an inheritance heirarchy are not destroyed on scope exit. > # */ > # auto class AutoTest > # { > # > # } > # > # auto class AutoTest1 : AutoTest > # { > # this() > # { > # printf( "AutoTest1 ctor\n" ); > # } > # > # ~this() > # { > # printf( "AutoTest1 dtor\n" ); > # } > # } > # > # > # void main() > # { > # try > # { > # auto AutoTest a = new AutoTest1(); > # } > # catch( Exception e ) > # { > # printf( "fail: %.*s\n", e.toString() ); > # } > # fullCollect(); > # printf( "done\n" ); > # } Added to DStress as http://dstress.kuehne.cn/run/auto_07.d http://dstress.kuehne.cn/run/auto_08.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFCXyC43w+/yD4P9tIRAkCwAJ9Uhg/tUDc1xwYsdSjqkqYKaAiksQCgkhQA 2p8x9ftU4QkeSjOL2iZFva0= =U6AF -----END PGP SIGNATURE----- |
Copyright © 1999-2021 by the D Language Foundation