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

Microsoft’s kernel guys use C not C++ - end of story!

Bill Casey
== SCSI Adapters & VirtualSCSI™ Target Mode Libs ==
Advanced Storage Concepts, Inc. (409) 744-2129

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

No, it’s a gripe.

-----Original Message-----
From: Kommuri, Chakradhar [mailto:Chakradhar.Kommuri@hp.com]
Sent: Wednesday, October 23, 2002 12:55 PM
To: NT Developers Interest List
Subject: [ntdev] Re: C++ in kernel. was Re: Batch file for Visual S
tudio build,

This looks like an ad??

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

The issue of correctly handling exceptions is a library issue and an OS
issue, not a language one. If MSVC++ 6.0 doesn’t have a good level of
support for kernel side code, that’s not a problem with the language but
a problem with that particular compiler ! Part of using a language in
kernel mode, well, any language for that matter, is to have a suitable
library that works fine in kernel mode and lets you use the full
language, or as much of it as it is possible.

Alberto.

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

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: 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: chakradhar.kommuri@hp.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@virtualscsi.com
> To unsubscribe send a blank email to %%email.unsub%%
>

Once Microsoft starts paying me (instead of the other way around), I’ll
start doing what Microsoft’s employees always do. Until then, I’ll do
what seems appropriate for the job at hand. (I use C for driver code
that is closest to the operating system - dispatch routines, etc., but
C++ for backend libraries that must be compiled under several different
environments).

  • Nicholas Ryan

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

Microsoft’s kernel guys use C not C++ - end of story!

Bill Casey
== SCSI Adapters & VirtualSCSIT Target Mode Libs ==
Advanced Storage Concepts, Inc. (409) 744-2129

> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com]On Behalf Of
Moreira, Alberto
> Sent: Wednesday, October 23, 2002 11:58 AM
> To: NT Developers Interest List
> Subject: [ntdev] Re: C++ in kernel. was Re: Batch file for Visual S
> tudio build,
>
>
> No, it’s a gripe.
>
> -----Original Message-----
> From: Kommuri, Chakradhar [mailto:Chakradhar.Kommuri@hp.com]
> Sent: Wednesday, October 23, 2002 12:55 PM
> To: NT Developers Interest List
> Subject: [ntdev] Re: C++ in kernel. was Re: Batch file for Visual S
> tudio build,
>
>
> This looks like an ad??
>
> -----Original Message-----
> From: Moreira, Alberto [mailto:xxxxx@compuware.com]
> Sent: Wednesday, October 23, 2002 11:48 AM
> To: NT Developers Interest List
> Subject: [ntdev] Re: C++ in kernel. was Re: Batch file for Visual S
> tudio build,
>
>
> The issue of correctly handling exceptions is a library
issue and an
> OS issue, not a language one. If MSVC++ 6.0 doesn’t have a
good level
> of support for kernel side code, that’s not a problem with the
> language but a problem with that particular compiler ! Part
of using a
> language in kernel mode, well, any language for that matter, is to
> have a suitable library that works fine in kernel mode and lets you
> use the full language, or as much of it as it is possible.
>
> Alberto.
>
>
> -----Original Message-----
> From: Jamey Kirby [mailto:xxxxx@storagecraft.com]
> Sent: Wednesday, October 23, 2002 12:40 PM
> To: NT Developers Interest List
> Subject: [ntdev] Re: C++ in kernel. was Re: Batch file for Visual S
> tudio build,
>
>
> 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:
> > 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:
> chakradhar.kommuri@hp.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@virtualscsi.com To
> > unsubscribe send a blank email to %%email.unsub%%
> >
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@nryan.com
> To unsubscribe send a blank email to %%email.unsub%%
>