#include #include #include #include struct test { int i; test(int ii):i(ii) { printf("test:ctor %i\n",i); } ~test() { printf("test:dtor %i\n",i ); } }; test t1(1); // global constructor should get called and desctructed on exit from our crt0 int somefunc() { test t2(2); } int main() { printf(" --- testing ctors & dtors ---\n"); somefunc(); test t3(3); std::cout << "bye bye" << std::endl; /* int myints[] = {32,71,12,45,26,80,53,33}; std::vector myvector (myints, myints+8); // 32 71 12 45 26 80 53 33 std::sort (myvector.begin(), myvector.begin()+4); //(12 32 45 71)26 80 53 33 for (std::vector::iterator it=myvector.begin(); it!=myvector.end(); ++it) printf("%i\n",*it); printf("hello\n"); printf("hello\n"); */ printf("-- fin -- \n"); } // printf("reent struct size: %d bytes\n",sizeof(struct _reent)); // printf("reent pointer : 0x%08x\n",_impure_ptr); //printf("reent pointer : 0x%08x\n",_impure_ptr); // constructing vectors /* #include #include #include #include //#undef _REENT_GLOBAL_STDIO_STREAMS int main() { std::cout << "hi" << std::endl; _REENT_INIT_PTR(_impure_ptr); // constructors used in the same order as described above: std::vector first; // empty vector of ints std::vector second (4,100); // four ints with value 100 std::vector third (second.begin(),second.end()); // iterating through second std::vector fourth (third); // a copy of third // the iterator constructor can also be used to construct from arrays: int myints[] = {16,2,77,29}; std::vector fifth (myints, myints + sizeof(myints) / sizeof(int) ); std::cout << "The contents of fifth are:"; for (std::vector::iterator it = fifth.begin(); it != fifth.end(); ++it) std::cout << ' ' << *it; std::cout << '\n'; return 0; } */