Random Link ¯\_(ツ)_/¯ | ||
Jul 26, 2022 | » | General Tips on Performance and Optimization
2 min; updated Jul 26, 2022
Trying to optimize may lead to errors and high-maintenance/change-resistant code. If there’s no need to optimize, let the code be. Only optimize performance-critical parts of a program. If your program spends 4% of its processing time doing computation A, and 40% of its time doing computation B, a 50% improvement on A is only as impactful as a 5% improvement on B. Complicated and/or low-level code is not necessarily faster than simple code.... |
Jun 4, 2022 | » | Enumerations in C++
7 min; updated Jun 4, 2022
Unscoped (or Plain or C-Style) Enumerations Plain (or C-style) enums are entered in the same scope as the name of their enum, and implicitly convert to their integer value, e.g. enum Color { red, green, blue }; int col = green; Color c2 = 1; // error: invalid conversion from 'int' to 'Color' [-fpermissive] enum CardColor { red, black }; // Error: "red" conflicts with a previous declaration... |