News for hackers. Stuff that matters.
Re:Recommendations about coding in C++ by leovonl on Monday February 20, 2017 @10:50AM (#13688220)
Funny how the "proper" first example still has a lot of things to be addressed, like the fact that it has a magic number (7) coming from nowhere, which is duplicated a few times as well.

It would be way less error-prone to calculate the number of elements using sizeof, for instance. This would also make the function independent of the type (a template could be used), thus reusable in another contexts.

There are no comments on this comment yet.