Move the test apps to a subdirectory
This commit is contained in:
1 parent
9925666790
commit
672182424e
5 files changed
+1
-1
No files matched your search
@@ -0,0 +1,49 @@
|
||||
#include <iostream>
|
||||
#include <stdio.h>
|
||||
|
||||
class Hello {
|
||||
public:
|
||||
Hello() {
|
||||
printf("Hello ctor\n");
|
||||
}
|
||||
~Hello() {
|
||||
printf("Hello dtor\n");
|
||||
}
|
||||
};
|
||||
|
||||
Hello global_h;
|
||||
|
||||
class RecurseClass {
|
||||
public:
|
||||
RecurseClass(int v) : val(v) {
|
||||
printf("ctor %d\n", val);
|
||||
}
|
||||
~RecurseClass() {
|
||||
printf("dtor %d\n", val);
|
||||
}
|
||||
private:
|
||||
int val;
|
||||
};
|
||||
|
||||
void recurse(int val) {
|
||||
RecurseClass obj(val);
|
||||
if (val == 0) {
|
||||
throw std::exception();
|
||||
}
|
||||
if (val == 5) {
|
||||
try {
|
||||
recurse(val - 1);
|
||||
} catch (std::exception& e) {
|
||||
printf("caught exception at %d\n", val);
|
||||
}
|
||||
} else {
|
||||
recurse(val - 1);
|
||||
}
|
||||
printf("finishing function recurse %d\n", val);
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
std::cout<<"Hello world C++"<<std::endl;
|
||||
recurse(10);
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <process.h>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
static __declspec(thread) int tlsvar = 1;
|
||||
#else
|
||||
static __thread int tlsvar = 1;
|
||||
#endif
|
||||
|
||||
static unsigned __stdcall threadfunc(void* arg) {
|
||||
int id = (int)arg;
|
||||
printf("thread %d, tlsvar %p %d\n", id, &tlsvar, tlsvar);
|
||||
tlsvar = id + 100;
|
||||
for (int i = 0; i < 5; i++) {
|
||||
printf("thread %d, tlsvar %p %d\n", id, &tlsvar, tlsvar);
|
||||
tlsvar += 10;
|
||||
Sleep(1000);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
HANDLE threads[5];
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
printf("mainthread, tlsvar %p %d\n", &tlsvar, tlsvar);
|
||||
tlsvar += 10;
|
||||
threads[i] = (HANDLE)_beginthreadex(NULL, 0, threadfunc, (void*)(intptr_t) (i + 1), 0, NULL);
|
||||
Sleep(750);
|
||||
}
|
||||
for (int i = 0; i < 5; i++) {
|
||||
WaitForSingleObject(threads[i], INFINITE);
|
||||
CloseHandle(threads[i]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
#define __USE_MINGW_ANSI_STDIO 1
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
printf("hello world! %f\n", 42.0);
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
#include <iostream>
|
||||
|
||||
class Hello {
|
||||
public:
|
||||
Hello() {
|
||||
printf("Hello ctor\n");
|
||||
}
|
||||
~Hello() {
|
||||
printf("Hello dtor\n");
|
||||
}
|
||||
};
|
||||
|
||||
Hello global_h;
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
std::cout<<"Hello world C++"<<std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user