Kubuntu Jaunty 9.04 Hangs desktop not responding

After I upgraded to Kubuntu Jaunty, I experienced a random hangs or crash, I can move my mouse, but nothing respond if I click. It seems to be the problem of the intel driver. I followed the instruction given here, and adding UXA in xorg.conf helps to solve my problem:
http://ubuntuforums.org/showthread.php?p=7293212#post7293212

Advertisements

undefined reference to `vtable for

I got this error when I compile a class:
undefined reference to `vtable for Device’

it turns out that GCC requires every virtual function to be defined, so I need to add an inline {} just to satisfy this.

virtual void setGridSpc(double a){};

instead of

virtual void setGridSpc(double a);

Maintaining C++ Codes

Some Ground rules:
1. Keep class data members private.

2. About global name space:
– Avoid data with external linkage at file scope: put all global variables in a structure, class, namespace, etc. This is to avoid name collison.
– Avoid free functions at file scope in .h files, avoid free functions with external linkage in .c files.
– Avoid enumerations, typedefs, and constants at file scope in .h files.
– Avoid using preprocessor macros in .h files, except as include guards.
– Only classes, structures, unions, free operator functions should be declared at file scope in a .h file; only classes, structures, unions, and inline functions should be defined at file scope in a .h file.

3. Place a unique and predictable include guard around the contents of each header file.

4. Place a redundant include guard around each preprocessor include directive in every header file.

5. Documentation the interfaces so that they are usable by others; have at least one other developer review each interface.

6. Use a consistent method to highlight class data member, const, statics. E.g.  adding a prefix d_ to class data members, or s_ for static data, ALL CAPS for const.

7. Don’t use “using namespace” directive in header files. It forfeit the purpose of having namespaces.

taken from: Large Scale C++ Software Design by John Lakos, 1996. Thinking in C++, 2nd Edition.

Global Constants in C++

Declaring the global constants can polute the names available and create conflicts as the project grow larger. One solution is to declare it using a namespace.

globalconst.h

namespace GlobalConst{

const double PI=3.14;

};

and in your file, simply use

GlobalConst::PI

UPDATE: I have corrected the code, thanks