Re: C++ in kernel. was Re: Batch file for Visual S tudio build,

That works by the way, it was in fact a recommended work around for an FPU
issue I was having. I had to have a try/exception handler around the code
in question. This came straight from MS.

-Justin

At 06:39 AM 10/23/2002, you wrote:

Throw exceptions… You mean C++ exceptions? In kernel-mode? I rest my
case…

Jamey

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Moreira, Alberto
Sent: Wednesday, October 23, 2002 9:12 AM
To: NT Developers Interest List
Subject: [ntdev] Re: C++ in kernel. was Re: Batch file for Visual S
tudio build,

Say you have an Irp class. You declare in the beginning of your program

Irp myirp;

By the time the next line has been executed, the constructor has already
run. How do you believe a return value from a constructor should be used
by
the language ? Then, say you have a line of code such as

Irp *newirp = new Irp(…parameters…);

here, again, how do you believe the return value should be used ? You
see,
constructors ain’t functions ! And if you really want to diagnose
errors,
you can throw an exception.

Alberto.

-----Original Message-----
From: Jamey Kirby [mailto:xxxxx@storagecraft.com]
Sent: Wednesday, October 23, 2002 11:57 AM
To: NT Developers Interest List
Subject: [ntdev] Re: C++ in kernel. was Re: Batch file for Visual Studio
build,

Let’s not forget about those constructors and destructors that have no
return value. This makes life real easy; NOT!

Jamey

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of David J. Craig
Sent: Wednesday, October 23, 2002 8:04 AM
To: NT Developers Interest List
Subject: [ntdev] Re: C++ in kernel. was Re: Batch file for Visual Studio
build,

> C has no advantage over C++ when it comes to good code design or
> efficiency. That is in the hands of the developer.
>
This is false in the first sentence, but the second is always true. If
you
have a group of junior device driver developers, the limited environment
in
“C” can help keep them from shooting themselves in the foot. Cobol is
even
better at allowing almost anyone with minimal skills to be a coder,
though
it takes a long time for them to become a programmer.

> My point is that people seem to be saying that if their file is
labeled
> “.cpp” there code will somehow be tainted and neither clear or
> efficient. Where do you draw the feature line at? Since c++ is a
> super-set of c, which features are the ones that don’t belong in the
> kernel? You can’t tell me none of them.
>
I use C++ in my device drivers because it makes sense. I use the .cpp
extensions even if the code is still pure “C” because the latest
Microsoft
compilers do a better job of catching errors. Since the stack is so
limited
in kernel mode, the full capabilities of C++ exception handling don’t
belong
and aren’t supported by Microsoft. Passing large data items on the
stack is
another bad idea in either “C” or “C++”.

> Does that mean if I prefer the power/features of
> a c++ compiler then by definition I don’t understand the language? I
have
> met so many C programmers that had zero clue about how the language
works
> or describes what is happening in the hardware. One of my favorite
> arguments that I heard in person: “There are no dynamic arrays in C”.
I
> spent hours trying to explain that “pointer” and “array”
> interchangeable. He left unconvinced, but said he would study it
further
> (he said it was a non portable compiler exploit or some nonsense).
>
I have been in environments, government, where you are give some people
who
the “system” says are programmers. You have a job to do and they are
your
resources. Sometimes you just have to apply the KISS principle even in
your
choice of language. Luckily in today’s civilian job environment, you
can
get rid of the non-performers, but it much more difficult in the
military or
civil service. It takes a supervisor at least a year to get a civilian
fired for incompetence and most supervisors don’t have that much time to
devote to that. It is easier to get the person promoted or transferred.

----- Original Message -----
From: “Justin Frodsham”
>To: “NT Developers Interest List”
>Sent: Wednesday, October 23, 2002 7:25 AM
>Subject: [ntdev] Re: C++ in kernel. was Re: Batch file for Visual Studio
>build,
>
>
>
>
>
>—
>You are currently subscribed to ntdev as: xxxxx@storagecraft.com
>To unsubscribe send a blank email to %%email.unsub%%
>
>
>
>—
>You are currently subscribed to ntdev as: xxxxx@compuware.com
>To unsubscribe send a blank email to %%email.unsub%%
>
>
>
>The contents of this e-mail are intended for the named addressee only.
>It
>contains information that may be confidential. Unless you are the named
>addressee or an authorized designee, you may not copy or use it, or
>disclose
>it to anyone else. If you received it in error please notify us
>immediately
>and then destroy it.
>
>
>
>—
>You are currently subscribed to ntdev as: xxxxx@storagecraft.com
>To unsubscribe send a blank email to %%email.unsub%%
>
>
>
>—
>You are currently subscribed to ntdev as: zeppelin@io.com
>To unsubscribe send a blank email to %%email.unsub%%