[ale] C++ "not all control paths return a value"

Geoffrey esoteric at 3times25.net
Fri Jan 28 19:50:44 EST 2005


Jay Loden wrote:
> I've got some code that compiles, but with a warning for the following 
> function:
> 
> string truncPath(string name){
>    if(name.substr(1, 1) == ":"){
>        for(int k=0; k < 30; k++){
>            if(name.substr(name.length()-k, 1) == "\\"){
>                string ret = name.substr(name.length()-k+1, k);
>                return ret;
>            }
>        }

I believe it means that you would exit the function without hitting a 
return that returns a value (here)

>    }
> 
>    else{
>        return name;
>    }
> }
> 
> Saying "Not all control paths return a value" - what does this mean, am 
> I missing something in my code?


-- 
Until later, Geoffrey



More information about the Ale mailing list