mathieu wrote:

> Hello,
> 
>   I am looking for a flag that would warn me about someting like this
> (*). I have tried so far:

I don't think that there is a warning, because AFAIK wrap around is the
only option for chip and compiler makers not killing performance in the
known safe cases. I'm not fully sure, but I think that there has been
some recent discussion about even mandating wrap-around.

The right thing to do would be correcting the source code

>   if ( index <= s - 1 )

if (index < s)

avoiding all problems, and following the C++ iterator range idiom. s==0
means never true, instead of always true as before. All occurences of
<= in index or iterator comparisions are suspicious.

Bernd Strieder


_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to