#include#include #include void my_routine(void * arg) { printf("\n hello \n"); } int main(int argc, char* argv[]) { pthread_t th; pthread_attr_t attr; pthread_attr_init(&attr); int rc = pthread_create(&th, (void *)&args, (void *)my_routine, NULL); return 0; }
Tuesday, March 10, 2009
Posix thread
Monday, March 2, 2009
C++ survival kit
http://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B#Operator_precedence
Complex Complex::operator+( Complex &other ) { return Complex( re + other.re, im + other.im ); }
// --------------------------------------- class MyPairClass { int pair_1; int pair_2; }; // --------------------------------------- template < class T, int i > class MyTemplate { public: T* testFunc(T* pl); }; template < class T, int i > T* MyTemplate::testFunc(T* p1) { return p1; }; // --------------------------------------- void myTemplateFunc() { MyPairClass * myPairClass = new MyPairClass(); MyTemplate < MyPairClass, 2 > myList; myList.testFunc(myPairClass); }
The default access to class members (members of a class type declared using the class keyword) is private; the default access to global struct and union members is public. For either case, the current access level can be changed using the public, private, or protected keyword.
const int maxarray = 255; char store_char[maxarray]; // allowed in C++; not allowed in C
Subscribe to:
Posts (Atom)