Gary Wessle wrote:
I read an example provided by Big Bucks Inc. no how to use their
library. in it they have some thing like
string doit(){ /* ... */ cout << "doit called" << endl; }
int main(){
doit();
}
how can this be correct?
should not doit() return void? and if not, what am I missing?
If a function returns something and another function makes no use
of that, it's perfectly OK. The return value is simply discarded
(and if it's a temporary, it's destroyed).
What seems to be dangerous (although not necessarily wrong) here
is that while 'doit' is declared to return 'string', it has not
'return' statement. I guess we aren't supposed to care about the
fact that your program as posted doesn't define 'string' or 'cout'
or 'endl'...
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask