SEO

vBulletin Search Engine Optimization


Go Back   Unix Technical Forum > Unix Operating Systems > HP-UX Operating System

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-10-2008, 04:53 PM
Syncnister
 
Posts: n/a
Default Absent of return in old C++ codes

Hello everyone,

I have found some old c++ code with function defined as returning
boolean. The thing is that doesn't have any return statement at the
end. Looking at how the function is being used, suggesting that it is
expected to return true by default.

bool MyFunction()
{
if (sometest)
{
return false;
}

somecode;
somecode;

// missing return
}

My compiler is the latest GCC / G++ and the target system is HPUX. My
testing environment (where I found the problem) is Cygwin. I suspect
that in HPUX I'm getting return value true as default, but on cygwin
I'm getting false.

I am trying to explain why this happen (to my self) and to justify
adding return false before the function exit. Appreciate any thought.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 03-10-2008, 04:53 PM
red floyd
  <div class="s