100DaysOfGameDev: Day 11

Another day, another rant about the book, but before that I will list the topics. Today's topics were also about functions mostly about the default arguments ( actually nice ), complex rules of function overloading with all intricacies ( probably will forget in a couple of days ), thoughts on pre and post-conditions for functions, pointers to function ( the old C way ), macros, conditional compilation, predefined macros, and pragmas. The default argument facilities are a nice feature I missed in Java, since ofc I can write three overloaded versions of a function, but it's sometimes nice to just have one function with default values. The function overloading is so complicated, because of the billion conversion rules, that C++ has, which I hate. Bjarne also talked about the pre and post-conditions of function, which basically means the valid input we as programmers expect to receive for valid output and ways to handle it. You definitely would not want to receive negative numbers for a function calculating the area of a rectangle. Nothing to say about function pointers, besides how little shit the author gives about code examples in the book. Again I hope that it is the early chapters and later chapters will be better. The issue is that as you read through the book everything makes sense until you try to run that code and see that it fails. Fourth edition, btw. That same person then hates on macros calling them a sign of a poor programmer and program ( he should check his code examples ). Although I cannot disagree, that macros should be usually avoided, besides the usage of #ifdef, which cannot be avoided. That's it for today, see you tomorrow!