On Tue, 16 Sep 2014 21:30:47 +0100 Maxime Coste <frrr...@gmail.com> wrote:
> Ok, so what exactly is the sum of 3 lines and 2 bytes ? The whole point > is to catch at compilation code that is logically invalid, if you have > f(ByteCount, LineCount), you cannot call it with a (LineCount, ByteCount) > signature. In C you would be forced to use f(int, int), and long debugging > sessions to discover this simple mistake. It depends on the strength of the initial design. Designing function-prototypes implicitly depends on the ability of the programmer to abstract it well enough so these errors don't show up. > It just gives you tool so that you can write your code closed to the domain > language, did you learn linear algebra writing matrix_add(m1, m2, &m3) > ? or m3 = m1 + m2 ? You basically owned yourself with this argument. With a function matrix_add(), you know what's happening (well, you know there is a function call). Overloaded operators are a pain in the ass not only because of complex compilation or convoluting the code, but also gotchas when you change the scope. It's hell for someone trying to get used to a new codebase. In C, he could've easily checked matrix_add and studied it, whereas with overloaded operators, it could happen _anywhere_ in the code. Good luck finding it! > You probably never worked on complicated enough code bases if you believe > every > program fits entirely in your brain. Putting safe guards in you code asserting > that what you believe is correct actually is is necessary if you want to keep > your sanity. There's a reason why big companies have moved away from C++ for serious stuff and now use Java and other crap. Not particularly a favorable thing for us suckless-people, but it kinda shows that C++ is not the "commercial grade"-language you want us to believe it is. > what is silly is rewriting the same function with different arguments again > and again. Or ending up relying on macros to emulate generics. Again, a matter of design. > Can't we have a civilized discussion ? Is Maxime a male or female name? Cheers FRIGN -- FRIGN <d...@frign.de>