News for hackers. Stuff that matters.
Re:Does C++ still deserve a bad rap? by 29athrowaway on Friday October 16, 2020 @08:57PM (#24806594)
If you mark the constructor as explicit, the automatic cast you mention does not take place and you'll get a compile time error.

The casting style can be enforced via linting. There are also C++ cast operators, that in my opinion should be preferred to the C style casts: static_cast, dynamic_cast, reinterpret_cast, const_cast, static_pointer, dynamic_pointer_cast, const_pointer_cast... and you can enforce that those are preferred rather than C style casts.

There are no comments on this comment yet.