Hello,
Monday, October 16, 2000, 11:12:52 AM, you wrote:
http://www.ddj.com/ftp/1998/1998_03/ntdd.zip/
There are few examples of device drivers written with WinDK and
DriverWorks on this link.
I do see __try/__finally statements in the code. Is it possible? few
weeks ago ecerybode told that impossible to use C++ exception control
statements in the drivers.
Best regards,
Sergey
> From: Sergey Kipnis [mailto:xxxxx@twins.com.pl]
I do see __try/__finally statements in the code. Is it possible? few
weeks ago ecerybode told that impossible to use C++ exception control
statements in the drivers.
__try/__finally aren’t C++ exceptions. Instead of it’s the so called
Structured Exception Handling (SEH), an OS mechanism supported by the MS
compiler at least.
The main difference to C++ exceptions is that destructors will not be
executed during stack unwinding and that C++ exceptions haven’t finally
block.
Refer to MSDN documentation for further information.
Yes, it can be done.
There is no contradiction: the __try __finally statements are not part of
C++ exception handling. That is called Structured Exception Handling
(supported by Visual C++) and can be used in driver developement (I’ve done
it myself). Personally I consider it better than C++ exception handling
since it’s available even in C code, not only C++.
For more information look in MSDN - start point can be “SEH” in the index.
----- Original Message -----
From: “Sergey Kipnis”
To: “NT Developers Interest List”
Sent: Monday, October 16, 2000 1:04 PM
Subject: [ntdev] Try/finally in device drivers
> Hello,
>
> Monday, October 16, 2000, 11:12:52 AM, you wrote:
>
> http://www.ddj.com/ftp/1998/1998_03/ntdd.zip/
>
> There are few examples of device drivers written with WinDK and
> DriverWorks on this link.
>
> I do see try/ finally statements in the code. Is it possible? few
> weeks ago ecerybode told that impossible to use C++ exception control
> statements in the drivers.
>
> Best regards,
> Sergey
Actually the __try/__finally construct should be considered more of a
“structured goto” rather than exception handling, as this from doesn’t
handle exceptions. Instead it provides a very nice way to format complex
loops and functions so that they have a single entry/single exit semantics.
__try/__except is the SEH exception handler.
-----Original Message-----
From: Paul Balanoiu [mailto:xxxxx@home.ro]
Sent: Monday, October 16, 2000 8:50 AM
To: NT Developers Interest List
Subject: [ntdev] Re: Try/finally in device drivers
Yes, it can be done.
There is no contradiction: the __try __finally statements are not part of
C++ exception handling. That is called Structured Exception Handling
(supported by Visual C++) and can be used in driver developement (I’ve done
it myself). Personally I consider it better than C++ exception handling
since it’s available even in C code, not only C++.
For more information look in MSDN - start point can be “SEH” in the index.
----- Original Message -----
From: “Sergey Kipnis”
To: “NT Developers Interest List”
Sent: Monday, October 16, 2000 1:04 PM
Subject: [ntdev] Try/finally in device drivers
> Hello,
>
> Monday, October 16, 2000, 11:12:52 AM, you wrote:
>
> http://www.ddj.com/ftp/1998/1998_03/ntdd.zip/
>
> There are few examples of device drivers written with WinDK and
> DriverWorks on this link.
>
> I do see try/ finally statements in the code. Is it possible? few
> weeks ago ecerybode told that impossible to use C++ exception control
> statements in the drivers.
>
> Best regards,
> Sergey
—
You are currently subscribed to ntdev as: xxxxx@stratus.com
To unsubscribe send a blank email to $subst(‘Email.Unsub’)
Don’t confuse C++'s exception with Win32’s Structured Exception Handling.
I’ve made that mistake more than a few times.
Greg
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Sergey Kipnis
Sent: Monday, October 16, 2000 6:05 AM
To: NT Developers Interest List
Subject: [ntdev] Try/finally in device drivers
Hello,
Monday, October 16, 2000, 11:12:52 AM, you wrote:
http://www.ddj.com/ftp/1998/1998_03/ntdd.zip/
There are few examples of device drivers written with WinDK and
DriverWorks on this link.
I do see __try/__finally statements in the code. Is it possible? few
weeks ago ecerybode told that impossible to use C++ exception control
statements in the drivers.
Best regards,
Sergey
You are currently subscribed to ntdev as: xxxxx@pdq.net
To unsubscribe send a blank email to $subst(‘Email.Unsub’)
> I do see __try/__finally statements in the code. Is it possible? few
weeks ago ecerybode told that impossible to use C++ exception control
statements in the drivers.
__try/__finally is a C exception control, not C++ one. This is an MS
addition to C language.
File system drivers and cache manager rely on __try/__finally heavily.
Max
> it myself). Personally I consider it better than C++ exception handling
since it’s available even in C code, not only C++.
BTW - mixing __try/__catch and C++ try/catch in the same source file is
impossible.
The latter requires “Enable Unwind Semantics” compiler option (enable
destructor calls while bypassing C++ exceptions) - which contradicts the
former.
Max