3 ms·
Since I know better than to suggests C++ programmers might be more capable of making mistakes than they realise, lets try a different question: How do you spot
by tialaramex 4y ago
Since I know better than to suggests C++ programmers might be more capable of making mistakes than they realise, lets try a different question: How do you spot this mistake when reviewing other people's code? Do you memorise a list of all the semantic requirements of each concept so that you can mentally check that the concept's requirements are satisfied appropriately by what was written each time ?
- gpderetta 4y agoI expect other people to write tests (including compile time tests).
- tialaramex 4y agoIf you were worried about behavioural problems, including UB, tests would help. But alas the problem here is IFNDR [Ill-formed No Diagnostic Required] so the compiler can't help you. All semantic constraints are your problem as the programmer, C++ decided that it's not the compiler's concern whether the program meets semantic constraints. Testing doesn't necessarily help at all, which is probably surprising.
- plorkyeran 4y agoThis isn't something I look for in code reviews because it's just not something I've ever see be the source of a bug. There are a million bugs that I've eventually tracked down to some subtle C++ thing, but I've never had one come down to a type which appears to conform to one of the standard library's concepts but actually doesn't.