By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,820 Members | 1,189 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,820 IT Pros & Developers. It's quick & easy.

Scope of an Arg

P: n/a
Hi,

Can someone answer this simple question:

Given:

string func();

func2( func.c_str() );

When does the string returned from func() go out of scope, after the
call to c_str() or after func2() completes?
thanks,
Mike

Jul 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Michael McKnerney <mi***************@baesystems.com> wrote in message news:<3F***************@baesystems.com>...
Hi,

Can someone answer this simple question:

Given:

string func();

func2( func.c_str() );


Victor says you probably meant func().c_str() here; I think you
probably meant
string func;
rather than
string func();

The latter does not construct a string called func but declares a
function called func that returns a string. This is why Victor talks
about applying c_str() to a function pointer.
Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.