C++ always use explicit constructor [closed]

The traditional wisdom is that constructors taking one parameter (explicitly or effectively through the use of default parameters) should be marked explicit, unless they do define a conversion (std::string being convertible from const char* being one example of the latter). You’ve figured out the reasons yourself, in that implicit conversions can indeed make life harder … Read more

Is it possible that Java String.split can return a null String[]

It never returns null. You should always check the javadoc of the method if you are not sure. For example String#split(String) says This method works as if by invoking the two-argument split method …and String#split(String,int) says: If the expression does not match any part of the input then the resulting array has just one element, … Read more

Erlang’s let-it-crash philosophy – applicable elsewhere?

It’s applicable everywhere. Whether or not you write your software in a “let it crash” pattern, it will crash anyway, e.g., when hardware fails. “Let it crash” applies anywhere where you need to withstand reality. Quoth James Hamilton: If a hardware failure requires any immediate administrative action, the service simply won’t scale cost-effectively and reliably. … Read more

When should I use Debug.Assert()?

In Debugging Microsoft .NET 2.0 Applications John Robbins has a big section on assertions. His main points are: Assert liberally. You can never have too many assertions. Assertions don’t replace exceptions. Exceptions cover the things your code demands; assertions cover the things it assumes. A well-written assertion can tell you not just what happened and … Read more