CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Threaded View

  1. #2
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,244

    Re: SEH hanlder cause compiler warnings and errors

    Here are the causes and possible fixes, quoted from MSDN Library:

    Compiler Warning C4509
    nonstandard extension used: 'function' uses SEH and 'object' has destructor

    You should not use structured exception handling in functions that use objects with destructors. If an exception occurs, the destructor cannot be called.
    Use C++ exception handling instead.

    Compiler Error C2712
    cannot use __try in functions that require object unwinding

    When you use /EHsc, a function with structured exception handling cannot have objects that require unwinding (destruction).
    Possible solutions:
    • Move code that requires SEH to another function
    • Rewrite functions that use SEH to avoid the use of local variables and parameters that have destructors. Do not use SEH in constructors or destructors
    • Compile without /EHsc
    Last edited by ovidiucucu; January 25th, 2014 at 06:07 AM.
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured