size_t and int comparison
From: tings (tings668_at_hotmail.com)
Date: 01/09/05
- Next message: Mike Wahler: "Re: size_t and int comparison"
- Previous message: Joaquín M López Muñoz: "Re: Link List with Tree behaviour"
- Next in thread: Mike Wahler: "Re: size_t and int comparison"
- Reply: Mike Wahler: "Re: size_t and int comparison"
- Reply: Victor Bazarov: "Re: size_t and int comparison"
- Reply: Jerry Coffin: "Re: size_t and int comparison"
- Reply: David Crocker: "Re: size_t and int comparison"
- Reply: Ron Natalie: "Re: size_t and int comparison"
- Reply: Ioannis Vranos: "Re: size_t and int comparison"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 09 Jan 2005 20:54:19 GMT
for (int i=0;i < strlen(pathcmd);i++){//this line cause a warning
warning C4018: '<' : signed/unsigned mismatch
strlen returns a number of type 'size_t'. size_t is an unsigned type and
you are comparing it to an int, a signed type.
Two solutions to remove the warning:
1. Change the type of the variable 'i' to 'size_t'.
2. staic_cast i to "unsigned" type.
Which way is better in C++?
- Next message: Mike Wahler: "Re: size_t and int comparison"
- Previous message: Joaquín M López Muñoz: "Re: Link List with Tree behaviour"
- Next in thread: Mike Wahler: "Re: size_t and int comparison"
- Reply: Mike Wahler: "Re: size_t and int comparison"
- Reply: Victor Bazarov: "Re: size_t and int comparison"
- Reply: Jerry Coffin: "Re: size_t and int comparison"
- Reply: David Crocker: "Re: size_t and int comparison"
- Reply: Ron Natalie: "Re: size_t and int comparison"
- Reply: Ioannis Vranos: "Re: size_t and int comparison"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|