From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10f8a1,e7e13c943c611b62 X-Google-Attributes: gid10f8a1,public X-Google-Thread: 1164f8,be3d6a6131c61fa7 X-Google-Attributes: gid1164f8,public X-Google-Thread: 102b75,be3d6a6131c61fa7 X-Google-Attributes: gid102b75,public From: zalman@netcom.com (Zalman Stern) Subject: Re: Exception handling Date: 1999/04/25 Message-ID: #1/1 X-Deja-AN: 470595259 Sender: zalman@netcom15.netcom.com References: <36E9F2A0.9A401A09@pacific.net.sg> <924046418.053.46@news.remarQ.com> Organization: ICGNetcom Followup-To: comp.arch,comp.sys.dec,vmsnet.alpha Newsgroups: comp.arch,comp.sys.dec,vmsnet.alpha Daniel P. B. Smith (dpbsmith@world.std.com) wrote: : I didn't expect it to; I expected the exception to get thrown upward past : and through the C library layer and get caught by the exception handlers : in my calling routines above. That is, to do what it would have done if : the C source code in the library had been compiled as C++ code by the C++ : compiler. Generally, this works except that C does not have destructors so as the stack is unwound, resources may leak. Also since the C code has no shot at capturing control and cleaning up, data structures may be left in an inconsistent state. [...] : Yeah, well, OK, I was stupid... but it's been YEARS since I had to worry : seriously about different compilers generating different calling : conventions... I don't see why C++ books don't BEGIN their : exception-handler chapters by warning you about this, instead of with : encomia encouraging you to use the feature. Do writers of C++ books just : assume that you have access to all the source code needed to build your : program? Actually, the problem is not restricted to exception handling. Both object layout (especially the data structures for method dispatch "vtables") and the generation of unique linkage names for overloaded functions ("name mangling") can differ from compiler to compiler on the same platform. (Or even worse, from version to version of the same compiler on a given platform.) There is definitely room for improvement in binary interoperability in C++ environments. -Z-