This is a discussion on Good principles needed. within the C++ Programming forums, part of the General Programming Boards category; Originally Posted by Yarin
Heh, I did that once. Not pretty.
Don't cast floats directly to DWORD, cast it to ...
Don't cast floats directly to DWORD, cast it to long first.
Use spaces to indent not tabs, or else your code's formating becomes IDE dependent.
Align your structs! Make sure all the struct's vars are aligned on a byte evenly divisible by the size of the var itself. (I.E don't have a WORD sitting on an odd byte)
When commenting, say why your doing what your doing, not what your doing.
I'd have to disagree on the spaces instead of tabs thing. But that's really a style/formatting guideline rather than a coding guideline. I'd say it would be better for a company to come up with their own set of code style guidelines for all their developers to use. That way everyone would have their IDE's set to indent the same amount, so spaces have no advantage over tabs then. Plus all other formatting would be consistent and therefore easier to read...