[complement-svn] SF.net SVN: complement: [1574] trunk/complement/explore/inquiry
Status: Pre-Alpha
Brought to you by:
complement
From: <com...@us...> - 2007-05-30 11:35:37
|
Revision: 1574 http://svn.sourceforge.net/complement/?rev=1574&view=rev Author: complement Date: 2007-05-30 04:35:35 -0700 (Wed, 30 May 2007) Log Message: ----------- what about of destructors order of auto objects? Added Paths: ----------- trunk/complement/explore/inquiry/AuTTL/ trunk/complement/explore/inquiry/AuTTL/Makefile trunk/complement/explore/inquiry/AuTTL/Makefile.inc trunk/complement/explore/inquiry/AuTTL/test.cc trunk/complement/explore/inquiry/AuTerm-order/ trunk/complement/explore/inquiry/AuTerm-order/Makefile trunk/complement/explore/inquiry/AuTerm-order/Makefile.inc trunk/complement/explore/inquiry/AuTerm-order/test.cc Property changes on: trunk/complement/explore/inquiry/AuTTL ___________________________________________________________________ Name: svn:ignore + obj Added: trunk/complement/explore/inquiry/AuTTL/Makefile =================================================================== --- trunk/complement/explore/inquiry/AuTTL/Makefile (rev 0) +++ trunk/complement/explore/inquiry/AuTTL/Makefile 2007-05-30 11:35:35 UTC (rev 1574) @@ -0,0 +1,10 @@ +# -*- Makefile -*- Time-stamp: <03/07/09 18:08:47 ptr> + +SRCROOT := ../.. +COMPILER_NAME := gcc + +include Makefile.inc +include ${SRCROOT}/Makefiles/top.mak + +#CXXFLAGS += -fuse-cxa-atexit +# LDFLAGS += -Wl,-rpath=${STLPORT_LIB_DIR} Added: trunk/complement/explore/inquiry/AuTTL/Makefile.inc =================================================================== --- trunk/complement/explore/inquiry/AuTTL/Makefile.inc (rev 0) +++ trunk/complement/explore/inquiry/AuTTL/Makefile.inc 2007-05-30 11:35:35 UTC (rev 1574) @@ -0,0 +1,4 @@ +# -*- makefile -*- Time-stamp: <02/07/14 14:03:13 ptr> + +PRGNAME = test +SRC_CC = test.cc Added: trunk/complement/explore/inquiry/AuTTL/test.cc =================================================================== --- trunk/complement/explore/inquiry/AuTTL/test.cc (rev 0) +++ trunk/complement/explore/inquiry/AuTTL/test.cc 2007-05-30 11:35:35 UTC (rev 1574) @@ -0,0 +1,69 @@ +#include <iostream> + +using namespace std; + +class Obj +{ + public: + + Obj( int _v ) : + v( _v ) + { cerr << "Obj(" << v << ")" << endl; } + + Obj& operator=( const Obj& o ) + { cerr << "=(" << o.v << ")" << endl; /* v = o.v; */ } + + Obj( const Obj& o ) + { v = o.v; cerr << "O(Obj" << o.v << ")" << endl; } + + ~Obj() + { cerr << "~Obj(" << v << ")" << endl; } + + int v; +}; + +Obj f() +{ + Obj v(1); + const Obj& v2 = v; + + return v2; +} + +const Obj& g() // ill-formed! +{ + Obj v(2); + const Obj& v3 = v; // <--- + + return v3; // <--- +} + +Obj h() +{ + Obj v(4); + Obj v2(5); + + return v2; +} + +int main() +{ + { + Obj v0( 0 ); + + v0 = f(); + } + { + Obj v1( 3 ); + + v1 = g(); + } + { + Obj v2( 6 ); + + v2 = h(); + } + + return 0; +} + Property changes on: trunk/complement/explore/inquiry/AuTerm-order ___________________________________________________________________ Name: svn:ignore + obj Added: trunk/complement/explore/inquiry/AuTerm-order/Makefile =================================================================== --- trunk/complement/explore/inquiry/AuTerm-order/Makefile (rev 0) +++ trunk/complement/explore/inquiry/AuTerm-order/Makefile 2007-05-30 11:35:35 UTC (rev 1574) @@ -0,0 +1,10 @@ +# -*- Makefile -*- Time-stamp: <03/07/09 18:08:47 ptr> + +SRCROOT := ../.. +COMPILER_NAME := gcc + +include Makefile.inc +include ${SRCROOT}/Makefiles/top.mak + +#CXXFLAGS += -fuse-cxa-atexit +# LDFLAGS += -Wl,-rpath=${STLPORT_LIB_DIR} Added: trunk/complement/explore/inquiry/AuTerm-order/Makefile.inc =================================================================== --- trunk/complement/explore/inquiry/AuTerm-order/Makefile.inc (rev 0) +++ trunk/complement/explore/inquiry/AuTerm-order/Makefile.inc 2007-05-30 11:35:35 UTC (rev 1574) @@ -0,0 +1,4 @@ +# -*- makefile -*- Time-stamp: <02/07/14 14:03:13 ptr> + +PRGNAME = test +SRC_CC = test.cc Added: trunk/complement/explore/inquiry/AuTerm-order/test.cc =================================================================== --- trunk/complement/explore/inquiry/AuTerm-order/test.cc (rev 0) +++ trunk/complement/explore/inquiry/AuTerm-order/test.cc 2007-05-30 11:35:35 UTC (rev 1574) @@ -0,0 +1,44 @@ +#include <iostream> + +using namespace std; + +class Obj +{ + public: + + Obj( int _v ) : + v( _v ) + { cerr << "Obj(" << v << ")" << endl; } + + Obj& operator=( const Obj& o ) + { v = o.v; cerr << "=(" << o.v << ")" << endl; } + + Obj( const Obj& o ) + { v = o.v; cerr << "O(Obj" << o.v << ")" << endl; } + + ~Obj() + { cerr << "~Obj(" << v << ")" << endl; } + + int v; + static int q; +}; + +int Obj::q; + +Obj f() +{ + Obj v1(1); + Obj v2(2); + + return v2; +} + +int main() +{ + Obj v0( 0 ); + + v0 = f(); + + return 0; +} + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |