TRY/CATCH can't be used in consruct phase.
Martijn Vels -- Vels0020@exact.nl
Monday, April 22, 1996
Hi guys,
I keep on having problems with static classes in combination with MFC.
When using TRY/CATCH blocks in a constructor of a class, and I put a
static variable of that class in my code, I get into problems on the TRY.
I end up in AFX_EXCEPTION_LINK::AFX_EXCEPTION_LINK() where a lookup is
done for the exception context in a static mapHTASK map table. This
object has however not yet been constructed, thus given assertions and
GP's.
I know this is kind of a C++ porblem (order of initialisation of static
objects), but does anyone know a way to avoid these problems? Current
work-around is just forget about the TRY/CATCH in the construct assuming
memory not (yet) running that low...
Environment: VC++ 1.52 - Win95
Martijn.
Larry Siden -- lsiden@jade.bioimage.com
Wednesday, April 24, 1996
Can you explain what you mean by "static class". Don't you mean
"static object"?
-ls
> From: Martijn Vels
> Date: Mon, 22 Apr 96 11:36:00 CET
> Encoding: 18 TEXT
> Sender: owner-mfc-l@netcom.com
> Precedence: list
> Reply-To: mfc-l@netcom.com
> Content-Type: text
> Content-Length: 762
>
>
> Hi guys,
>
> I keep on having problems with static classes in combination with MFC.
> When using TRY/CATCH blocks in a constructor of a class, and I put a
> static variable of that class in my code, I get into problems on the TRY.
> I end up in AFX_EXCEPTION_LINK::AFX_EXCEPTION_LINK() where a lookup is
> done for the exception context in a static mapHTASK map table. This
> object has however not yet been constructed, thus given assertions and
> GP's.
> I know this is kind of a C++ porblem (order of initialisation of static
> objects), but does anyone know a way to avoid these problems? Current
> work-around is just forget about the TRY/CATCH in the construct assuming
> memory not (yet) running that low...
>
> Environment: VC++ 1.52 - Win95
> Martijn.
>
>
============================================================================
Larry Siden, Senior Software Engineer phone: 313-930-9900 x211 (w)
Bio Image, Inc.
777 E. Eisenhower Pky, Suite 950 email: (w) lsiden@bioimage.com
Ann Arbor, MI 48108 (h) 73677.1646@compuserve.com
| Вернуться в корень Архива
|