[Bug c/39479] strlen() strange behaviour in for()

jakub at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Tue Mar 17 09:45:00 GMT 2009



------- Comment #1 from jakub at gcc dot gnu dot org  2009-03-17 09:45 -------
Just learn C.  strlen return type is size_t, unsigned type, so in the third
case you have (assuming size_t is say unsigned long) i <= 0UL - 1, unsigned
long comparison, which is evaluated as (unsigned long) i <= -1UL, so it loops
forever.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39479



More information about the Gcc-bugs mailing list