Re:Bounded Integer: Header-only C++ library replaces integer...
by rleigh on Sunday September 29, 2019 @01:39PM
(#21108408)
I'm assuming here that they would use the `size_type` for the container they are iterating over. Otherwise I'm not sure.
[ Parent
| on HN ]
Re:Bounded Integer: Header-only C++ library replaces integer...
by ncmncm on Sunday September 29, 2019 @03:27PM
(#21109132)
An unsigned type is sometimes a poor choice for a loop index. The compiler then cannot assume the loop will terminate, and generate worse code. Usually this doesn't matter -- until you discover it did.
Re:Bounded Integer: Header-only C++ library replaces integer...
by rleigh on Sunday September 29, 2019 @03:42PM
(#21109231)
Good point. Probably not a problem in practice for most containers, but yet another reason for why the STL (and C library, for that matter) should have used a signed size type from the beginning.