Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Coding Standard Nazis

Name: Anonymous 2015-02-15 10:59

http://wiki.wesnoth.org/CodingStandards

Do not use #define for constants
#define foo X is not a typesafe approach to define constants. Instead, you can something like the following (in an anonymous namespace) to achieve the same goal in a typesafe fashion.

Do not use C-style casts
The following code,
if(i->second.side() == (size_t)player_number_) {
is considered bad practice in C++ since a C-style cast is overpowered -- if types change around it could end up casting away constness, or performing an implementation-defined data reinterpretation (basically a C-style cast is a compiler-generated combination of static_cast, reinterpret_cast, and const_cast).

Name: Anonymous 2017-01-17 1:00

Thanks to strong typing and optimizing compilers, nowadays it's possible to get better performance with C++ than C without even trying. C code has to be fine tuned by someone who used to write assembly to catch up to the magic that some optimizing C++ compilers do. There's no pride in, as a human, knowing how to make tiny insignificant operations fast. What matters is higher level algorithms nowadays, which is harder. Just as automation/good algorithms is taking away the jobs of toilet scrubbers, so will it replace ASM-worshipping, bit-licking, imperative skiddies like Cudder.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List