size_t index=-1;

Johan Engelen via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Mar 16 15:17:53 PDT 2016


On Wednesday, 16 March 2016 at 22:07:39 UTC, Anonymouse wrote:
> 
> size_t pos = "banana".indexOf("c");
> if (pos > 0) {

Although I also think it makes sense to warn (in specific cases) 
about mixed-sign comparisons, the example you give here does 
nothing that we can warn about. It is a comparison of an unsigned 
"pos" with a literal that is unsigned too. ("0" literal must be 
considered signed and unsigned without any warnings)


More information about the Digitalmars-d-learn mailing list