returning unconstructed objects - bug or a feature?
Jakob Oestergaard
jakob@unthought.net
Tue Apr 22 09:16:00 GMT 2003
On Thu, Apr 17, 2003 at 04:39:16AM -0400, Nebojsa Sabovic wrote:
> Hello,
>
> I noticed that when the return statement is omitted from the function that is
> supposed to return an object, no constructor is invoked on the object. It
> seemed logical to me that the default constructor should be invoked.
Such code is broken.
Always compile with -Wall (no discussion) - you may want to compile with
"-Wall -Werror" (that's a matter of taste).
> For
> instance, if we write int main () and we never say return, I expect the
> function to return 0 (which is what happens when you write return int()).
"main" is special and "int" is not a class.
--
................................................................
: jakob@unthought.net : And I see the elder races, :
:.........................: putrid forms of man :
: Jakob Ãstergaard : See him rise and claim the earth, :
: OZ9ABN : his downfall is at hand. :
:.........................:............{Konkhra}...............:
More information about the Gcc-bugs
mailing list