From: Ioannis V. <no...@ya...> - 2001-09-05 22:43:45
|
> -----Original Message----- > From: dev...@li...=20 > [mailto:dev...@li...] On Behalf=20 > Of Michael C > Sent: Wednesday, September 05, 2001 11:56 PM > To: Ioannis Vranos; Dev-C++ > Subject: Re: [Dev-C++] C++ question >=20 >=20 > As stated in the previous email, I agree. >=20 > However, it would be interesting to see what happens if you=20 > make an object in the initialiser list consistantly fail on=20 > construction-initialisation. Then when the exception is=20 > caught in the catch block, construct the object again. A=20 > recursive construction-failure scenario as you suggest. Yes. >=20 > If the compiler is clever enough it should report this as a=20 > warning. I guess it can not report this as an error as it=20 No, i have done already this by calling this->X(7); when we were discussing the matter for first time and it compiled ok of course since it is not a syntax error but a logical. The resulting exe fell in infinite recursion (printing the same 2 messages the whole time). The compiler must be clever catching the syntax errors and not the logical. If it was so logical, it could write the program itself. :) > doesn't stop you from programming recursive functions in=20 > general, and you could forget the base test in one of these=20 > and hang your program. Yes, it can't report it as an error, recursion is not an error as a concept 9although it must be avoided). >=20 > I may try this out this weekend. >=20 > When you say 'continue below the catch block' I guess this is=20 > a typo and you mean within the catch block. I don't think you=20 > can have another block under the catch block as this would be=20 > outside the scope of the constructor. Yes, that message was before the other you answered first, which stated that the end of the function is at the end of the catch block. In summary, we can't write outside the catch block. Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.f2s.com * Alternative URL: http://run.to/noicys |