mirror of
				https://github.com/c64scene-ar/llvm-6502.git
				synced 2025-10-31 08:16:47 +00:00 
			
		
		
		
	git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6165 91177308-0d34-0410-b5e6-96231b3b80d8
		
			
				
	
	
		
			28 lines
		
	
	
		
			474 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			474 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #include <stdio.h>
 | |
| //extern int printf(const char *, ...);
 | |
| 
 | |
| int CN = 0;
 | |
| int DN = 0;
 | |
| 
 | |
| struct foo {
 | |
|   int Num;
 | |
|   foo(int num) : Num(num) {
 | |
|     printf("Foo ctor %d %d\n", Num, CN++);
 | |
|   }
 | |
|   ~foo() {
 | |
|     printf("Foo dtor %d %d\n", Num, DN++);
 | |
|   }
 | |
| } Constructor1(7);     // Global with ctor to be called before main
 | |
| foo Constructor2(12);
 | |
| 
 | |
| struct bar {
 | |
|   ~bar() {
 | |
|     printf("bar dtor\n");
 | |
|   }
 | |
| } Destructor1;     // Global with dtor
 | |
| 
 | |
| int main() {
 | |
|   printf("main\n");
 | |
|   return 0;
 | |
| }
 |