Aussie AI
Medium-Sized Slugs
-
Book Excerpt from "Generative AI in C++"
-
by David Spuler, Ph.D.
Medium-Sized Slugs
There are a lot more examples of possible inefficiencies in C++ coding. Some of the types of errors that are “medium-sized” slugs include:
- Automatic array initializations with constant data.
- Loop test function calls (ie. expensive loop conditional tests).
- Member initializations in the constructor body (they should be in the initializer lists).
- Program startup hidden initializations (global or
static
object constructors). - Small non-
inline
functions called frequently. - Busy wait loops.
- Unnecessary code inside loops.
- C++ classes wrapping simple data types (e.g. overuse of “smart pointers” or “smart integer” classes).
- Overuse of standard string concatenation operations.
- Recursion is almost always a slug.
• Next: • Up: Table of Contents |
The new AI programming book by Aussie AI co-founders:
Get your copy from Amazon: Generative AI in C++ |