سؤال

أرى Doug Harrison جعلت بيان جيد لما هو "خطأ" باستخدام استثناءات منظمة (أي جذاب) (انظر سؤال رقم 3 ).ولكن ما هي العواقب الأخرى هناك؟على سبيل المثال، ما يحدث إذا كان لدي العديد من المشاريع التي تم تجميعها مع / EHA، مختلطة مع المشاريع الأخرى التي تم تجميعها مع / EHS؟هل هناك مشكلات عندما ترتبط المكتبات (تجميع الوقت أو وقت التشغيل) مع بعضنا البعض؟

ولكن هذا مجرد مثال واحد.ما هي القضايا الأخرى التي قد تكون هناك؟

هل كانت مفيدة؟

المحلول

/EHa disables an optimization. With /EHs in effect, the compiler can omit exception filters if it can be sure that no C++ exception is ever thrown by the code wrapped in a try {}. That's a small space optimization on x86 and x64, very small time optimization on x86. Problem is, those filters are needed if you catch non-C++ exceptions. The consequence is that the stack gets unwound when such an exception is caught without the destructor of a C++ object getting called. Not good, /EHa avoids it.

Mixing doesn't cause linker problems. It causes the above problem.

Yes, /EHa also makes catch(...) do a very stupid thing, it really catches everything. That ship wreck sailed a while ago though, Pokemon C++ exception handling is a bad idea too.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top