#41 Returning address of temporary variable.

closed-fixed
9
2003-12-16
2003-03-13
No

In registry.cpp

const std::string
Registry::ConstSubnodeIterator::operator*()
{
return
it_sub->first;
}

const std::string *
Registry::ConstSubnodeIterator::operator->()
{
return
&operator*();
}

The second function returns address
of temporary object.
Should the first one return const
std::string & instead of const std::string?

Discussion

  • Petr Tovarys

    Petr Tovarys - 2003-05-04
    • status: open --> open-remind
     
  • Marek Vondrak

    Marek Vondrak - 2003-05-09

    Logged In: YES
    user_id=122416

    Ping!

     
  • Marek Svantner

    Marek Svantner - 2003-12-16
    • status: open-remind --> closed-fixed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks