General statistics
List of Youtube channels
Youtube commenter search
Distinguished comments
About
Lepi Doptera
Low Level
comments
Comments by "Lepi Doptera" (@lepidoptera9337) on "how Google writes gorgeous C++" video.
And it shows in your crappy code. ;-)
2
Yes, if you don't care that your program will terminate randomly with no way for the user to find out where the source of the problem is. If you do care, then you avoid exceptions and you build an explicit error handler library that logs errors and allows for proper program continuation at all times.
1
Google basically tells you what every experienced programmer knows: OOP is a shite concept. :-)
1
Use auto if you don't mind it generating the wrong result. ;-)
1
@ I can tell you that the problem exists with all "auto" features. In Excel, for instance, the program formats cells depending on whether they look like a string or a number. Tons of spreadsheets are failing because somebody types a string that looks like a number or the other way round. It's even worse with dates. There are features and then there are stupid features. This one is the latter.
1
@ It's not a matter of coercion. It's a matter of producing errors that are not easily visible in the code. If you want a dynamic language like Python, then use a dynamic language, but don't pretend that going there halfway will save you from the severe problems that dynamic languages have. At least pointers are absolutely necessary, but this isn't. I rather have a programmer spell out all types explicitly than have a language/compiler that can generate a type system with exponential complexity automatically. The latter is not safe design. It's also not clear to me that it would be useful. Everything that can be done with types at compile time can be done much better with data at runtime.
1
@ OK, I play. What does it do in your opinion that you can't live without and that you can't do much better and safer without it? I wasn't just talking about "auto" here, of course. I was talking about the entire failed design philosophy of C++.
1
@ignacionr I understand the design of C++ just fine. Stroustrup explains in his book that he wanted to move as much from runtime to compile time as possible. auto and templates are basically the compile time equivalent of dynamic types. And that is the problem. Dynamic types are a bad idea. It doesn't get any better just because you unroll all possible types during compile time (at most it makes it worse in some sense). Here is the Python example of what auto does: a = [] # a one dimensional array a= [a,a] # a two dimensional array print(a) the program results in [[],[]] I can put the above even in a loop: a = [] for i in range[20]: a = [a,a] and now I am getting a one million dimensional array! If I make a tree, I can construct all possible array dimensions from one to a million... in no time. I can make more complicated structures like that, like arrays of dictionaries containing dictionaries of arrays etc.. See the problem? Exponential type multiplication. No programmer can possibly keep up with the consequences of that. auto and templates do the same thing, except that you are limited to a fixed number of type generations that are being unrolled by the compiler, but you can still proliferate types exponentially. Bad, bad idea.
1