Re: [eigen] Signed or unsigned indexing

[ Thread Index | Date Index | More Archives ]

Sure, from the compiler authors perspective, the current behavior of signed integers in C++ is ideal. Since overflow is undefined behavior, for them it is optimization opportunities. They can do all sorts of optimizations thanks to being able to assume that overflow does not happen.

But from the perspective of software developers, the undefined behavior in signed overflow is danger.

That leads to one of the strongest arguments in favor of unsigned: at least, that has well-defined (wrapping) overflow behavior. That might be 'broken', but it isn't nearly as dangerous as the undefined behavior of signed overflow!

The point I want to make is: compiler users (us, here) and compiler authors have inherently different, sometimes conflicting, agenda.

Again --- not advocating for unsigned indices! Just saying it's not clear-cut either way.


2017-01-20 12:48 GMT-05:00 Mark Borgerding <mark@xxxxxxxxxxxxxx>:
Well made points.  These greatly expand on  points I made on this list in May 2010.

Mail converted by MHonArc 2.6.19+