Today, we are going to talk about when and why structs should have constructors if they should have them at all. We are also going to see once again that generic best practices and best practices to reduce binary size do not always go hand in hand. I had some time to dedicate to cleaning up code. I remembered that recently I saw some structs like this: 1 2 3 4 SomeSimpleStuct data; data.a_number = 42; data.a_character = 'a'; return data; I didn’t like this code. Even though the struct didn...| Sandor Dargo’s Blog
During the last few months, we discussed a lot about how to write code to limit the size of our binary. We should think twice if we want to turn a class into polymorphic, exceptions also take a heavy toll and we might end up defaulting special functions in the cpp file which is quite unintuitive. There are practices going against common sense and also that can be considered a best practice in any case. I think it’s good to know about them. But how you compile your code is also important! So...| Sandor Dargo’s Blog