News for hackers. Stuff that matters.
Re:Pitfalls in C and C++: Unsigned Types (2011) by ggchappell on Wednesday September 25, 2013 @11:45PM (#6448828)
When the rubber meets the road, and I need to write some actual code, I guess I'm not sure what is being recommended here. Say I need to iterate through the indices of a vector--his "strongest counterargument". He suggests "casting the unsigneds to signed integers". Am I supposed to do this?

  for (ptrdiff_t i = 0; i != ptrdiff_t(v.size()); ++i)
I think the real answer here is for something like Python's itertools to be in the C++ Standard Library, so that we never need to do anything remotely like the code above. But failing that, it isn't clear to me what the "best practices" version of the above would be.

There are no comments on this comment yet.