sphair / ClanLib

ClanLib is a cross platform C++ toolkit library.
Other
344 stars 76 forks source link

Style improvments. #54

Closed LethalGhost closed 9 years ago

LethalGhost commented 9 years ago

Replace assigning with member initialization. Add virtual destructors to basic classes. Replace c-style cast with cpp-style cast. Some minor style improvements.

dpjudas commented 9 years ago

Adding virtual destructors to classes is not a good idea unless they already have virtual functions or need to have a virtual table for dynamic casting purposes. There is an overhead to having a virtual table and it also changes an class/struct to no longer being a StandardLayoutType, and thus also not a POD.

This is a particular important requirement for our matrix+vector types as we use them for data exchange with the GPU and thus must have a stronger guarantee that for example sizeof(Vec4f) == 4 * sizeof(float).

dpjudas commented 9 years ago

Forgot to add the links to http://en.cppreference.com/w/cpp/concept/StandardLayoutType and http://en.cppreference.com/w/cpp/concept/PODType for further information.

LethalGhost commented 9 years ago

Ok, got it. Fix this shortly. Is it OK if I ask you a few questions about ClanLib later?

LethalGhost commented 9 years ago

Updated.

rombust commented 9 years ago

Feel free to ask questions either via github or #clanlib on irc.freenode.net (however the only active developers on there is currently myself and judas)