RE: C++ in kernel. was Re: Batch file for Visual Studio b uild,

>There is one more delegation of function call because kernel API is C

API. But this is not so
bad, you could even use __fastcall in your C++ define of the member
function. the “this” and

For what? What advantages are achieved by this extra call?
This is like MFC’s CDC. Never used it in MFC apps, used the HDC
instead. Unnecessary wrapper.

place or two. It makes your code cleaner since you simply access your
data members in your
class “this-and-that” (implicitly this->this_and_that).

Cleaner code is the code where everything is explicitly qualified, so,
I prefer MyObj->Field.

Another example is C++ template library wrapping of
list/map/queue/tree is easier and
cleaner than using C API and CONTAINING_RECORD macro while it incurs
no overhead
and code size penalty compared to C because its inline nature.

I see no difference.

Using a C++ library saves you a lot of typing,
copy-paste-modify-rename.

At the expense of much, much lesser code readability.

It is more robust code reuse.

Absolutely not so, since the code becomes nearly unreadable.
Code reuse of C code on copy/paste basis or on .C/.H module basis is
much more a reality.

Look at Microsoft class, port, miniclass, miniport driver model, etc.
I wished it could be in a
class library form.

For what? To tie the OS to pecularities of the particular compiler and
to introduce the extra layer of undocumented innerworkings (how VMT is
placed etc)?

Look at DMA adapator object API, does that not look like a C++
object?

Exactly, or UNIX’s vnode is another example. This means - you can do
polymorphism without a language with hidden semantics. So why
introduce it?
The amount of typing necessary to define the vnode’s methods or the
C++ class is nearly the same.

Things like MDL etc.

In my C++ library, I don’t have many layers of inheritance, most no

That’s good. Deep inheritance trees are very, very rarely useful (UI
components is nearly the only place) while their drawbacks in code
readability are obvious.

and faster than NT. If the kernel API is in C++

C++ syscalls??? To tie all apps to some compiler?

Also - it is good that C++ is not “pure OOP”, since the “pure OOP”
idea if flawed by definition. These languages are just plain slow.

There are good things in OOP - encapsulation and polymorphysm.
Inheritance is more often an evil, and abstract datatypes (operator +)
are just evil in terms of code readability.
But the good things of OOP are achievable in C, without a language
with hidden semantics.

Note COM. This technology is the exact subset of C++ features worth
using. No wonder MS ported it to kernel for KS/PortCls stack.

IMHO C++ is more suitable for inherently OO (like a virtual
world-style game with items and NPCs, or like a CAD) tasks, for UI
tasks and as a “smarter kind of Visual Basic” for whole lot of
nearly-VB-suitable tasks like writing email servers, document
management etc. System-level development is not such.

So, if use C++ in the kernel, one must define a narrow subset of
“features worth using in terms of code readability” and then follow
this subset.

Max

There are probably 1000 messages in the archive on this. Do we need to always repeat history?

Here’s the summary: Good programmers can write good drivers in C and C++, bad programmers will write bad drivers in either
language.

-DH

PS. If you can come up with a way to give the bad programmers less choices and have them write less code, you are better off.
PPS. C programmers learning C++ and implementing there first C++ driver will screw-up big time.

“Maxim S. Shatskih” wrote in message news:xxxxx@ntdev…
>
> >There is one more delegation of function call because kernel API is C
> >API. But this is not so
> >bad, you could even use __fastcall in your C++ define of the member
> >function. the “this” and
>
> For what? What advantages are achieved by this extra call?
> This is like MFC’s CDC. Never used it in MFC apps, used the HDC
> instead. Unnecessary wrapper.
>
> >place or two. It makes your code cleaner since you simply access your
> >data members in your
> >class “this-and-that” (implicitly this->this_and_that).
>
> Cleaner code is the code where everything is explicitly qualified, so,
> I prefer MyObj->Field.
>
> >Another example is C++ template library wrapping of
> >list/map/queue/tree is easier and
> >cleaner than using C API and CONTAINING_RECORD macro while it incurs
> >no overhead
> >and code size penalty compared to C because its inline nature.
>
> I see no difference.
>
> >Using a C++ library saves you a lot of typing,
> copy-paste-modify-rename.
>
> At the expense of much, much lesser code readability.
>
> >It is more robust code reuse.
>
> Absolutely not so, since the code becomes nearly unreadable.
> Code reuse of C code on copy/paste basis or on .C/.H module basis is
> much more a reality.
>
> >Look at Microsoft class, port, miniclass, miniport driver model, etc.
> >I wished it could be in a
> >class library form.
>
> For what? To tie the OS to pecularities of the particular compiler and
> to introduce the extra layer of undocumented innerworkings (how VMT is
> placed etc)?
>
> >Look at DMA adapator object API, does that not look like a C++
> object?
>
> Exactly, or UNIX’s vnode is another example. This means - you can do
> polymorphism without a language with hidden semantics. So why
> introduce it?
> The amount of typing necessary to define the vnode’s methods or the
> C++ class is nearly the same.
>
> Things like MDL etc.
>
> >In my C++ library, I don’t have many layers of inheritance, most no
>
> That’s good. Deep inheritance trees are very, very rarely useful (UI
> components is nearly the only place) while their drawbacks in code
> readability are obvious.
>
> >and faster than NT. If the kernel API is in C++
>
> C++ syscalls??? To tie all apps to some compiler?
>
> Also - it is good that C++ is not “pure OOP”, since the “pure OOP”
> idea if flawed by definition. These languages are just plain slow.
>
> There are good things in OOP - encapsulation and polymorphysm.
> Inheritance is more often an evil, and abstract datatypes (operator +)
> are just evil in terms of code readability.
> But the good things of OOP are achievable in C, without a language
> with hidden semantics.
>
> Note COM. This technology is the exact subset of C++ features worth
> using. No wonder MS ported it to kernel for KS/PortCls stack.
>
> IMHO C++ is more suitable for inherently OO (like a virtual
> world-style game with items and NPCs, or like a CAD) tasks, for UI
> tasks and as a “smarter kind of Visual Basic” for whole lot of
> nearly-VB-suitable tasks like writing email servers, document
> management etc. System-level development is not such.
>
> So, if use C++ in the kernel, one must define a narrow subset of
> “features worth using in terms of code readability” and then follow
> this subset.
>
> Max
>
>
>
>
>

C++ in kernel … Bahh. Whatever you are a good or a bad programmer , you
should stay away from C++. Or for that matter , stay away from writting
drivers in Visual Basic, C#,
Perl or Lua.

----- Original Message -----
From: “Dave Harvey”
Newsgroups: ntdev
To: “NT Developers Interest List”
Sent: Sunday, October 20, 2002 6:39 AM
Subject: [ntdev] Re: C++ in kernel. was Re: Batch file for Visual Studio b
uild,

> There are probably 1000 messages in the archive on this. Do we need to
always repeat history?
>
> Here’s the summary: Good programmers can write good drivers in C and C++,
bad programmers will write bad drivers in either
> language.
>
> -DH
>
> PS. If you can come up with a way to give the bad programmers less choices
and have them write less code, you are better off.
> PPS. C programmers learning C++ and implementing there first C++ driver
will screw-up big time.
>
> “Maxim S. Shatskih” wrote in message
news:xxxxx@ntdev…
> >
> > >There is one more delegation of function call because kernel API is C
> > >API. But this is not so
> > >bad, you could even use __fastcall in your C++ define of the member
> > >function. the “this” and
> >
> > For what? What advantages are achieved by this extra call?
> > This is like MFC’s CDC. Never used it in MFC apps, used the HDC
> > instead. Unnecessary wrapper.
> >
> > >place or two. It makes your code cleaner since you simply access your
> > >data members in your
> > >class “this-and-that” (implicitly this->this_and_that).
> >
> > Cleaner code is the code where everything is explicitly qualified, so,
> > I prefer MyObj->Field.
> >
> > >Another example is C++ template library wrapping of
> > >list/map/queue/tree is easier and
> > >cleaner than using C API and CONTAINING_RECORD macro while it incurs
> > >no overhead
> > >and code size penalty compared to C because its inline nature.
> >
> > I see no difference.
> >
> > >Using a C++ library saves you a lot of typing,
> > copy-paste-modify-rename.
> >
> > At the expense of much, much lesser code readability.
> >
> > >It is more robust code reuse.
> >
> > Absolutely not so, since the code becomes nearly unreadable.
> > Code reuse of C code on copy/paste basis or on .C/.H module basis is
> > much more a reality.
> >
> > >Look at Microsoft class, port, miniclass, miniport driver model, etc.
> > >I wished it could be in a
> > >class library form.
> >
> > For what? To tie the OS to pecularities of the particular compiler and
> > to introduce the extra layer of undocumented innerworkings (how VMT is
> > placed etc)?
> >
> > >Look at DMA adapator object API, does that not look like a C++
> > object?
> >
> > Exactly, or UNIX’s vnode is another example. This means - you can do
> > polymorphism without a language with hidden semantics. So why
> > introduce it?
> > The amount of typing necessary to define the vnode’s methods or the
> > C++ class is nearly the same.
> >
> > Things like MDL etc.
> >
> > >In my C++ library, I don’t have many layers of inheritance, most no
> >
> > That’s good. Deep inheritance trees are very, very rarely useful (UI
> > components is nearly the only place) while their drawbacks in code
> > readability are obvious.
> >
> > >and faster than NT. If the kernel API is in C++
> >
> > C++ syscalls??? To tie all apps to some compiler?
> >
> > Also - it is good that C++ is not “pure OOP”, since the “pure OOP”
> > idea if flawed by definition. These languages are just plain slow.
> >
> > There are good things in OOP - encapsulation and polymorphysm.
> > Inheritance is more often an evil, and abstract datatypes (operator +)
> > are just evil in terms of code readability.
> > But the good things of OOP are achievable in C, without a language
> > with hidden semantics.
> >
> > Note COM. This technology is the exact subset of C++ features worth
> > using. No wonder MS ported it to kernel for KS/PortCls stack.
> >
> > IMHO C++ is more suitable for inherently OO (like a virtual
> > world-style game with items and NPCs, or like a CAD) tasks, for UI
> > tasks and as a “smarter kind of Visual Basic” for whole lot of
> > nearly-VB-suitable tasks like writing email servers, document
> > management etc. System-level development is not such.
> >
> > So, if use C++ in the kernel, one must define a narrow subset of
> > “features worth using in terms of code readability” and then follow
> > this subset.
> >
> > Max
> >
> >
> >
> >
> >
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@rdsor.ro
> To unsubscribe send a blank email to %%email.unsub%%
>

> PPS. C programmers learning C++ and implementing there first C++
driver will screw-up

big time.

Exactly. To practice C++, there are better things, like user-mode MFC
and ATL libraries.

Max

No doubts. I think that if I’m good in C++, I won’t ask anyone if is it good
or bad to use C++ anywhere. It’s up to programmer to decide under which
circumstances to use certain language.

/regards/

----- Original Message -----
From: “Maxim S. Shatskih”
To: “NT Developers Interest List”
Sent: Sunday, October 20, 2002 11:19 PM
Subject: [ntdev] Re: C++ in kernel. was Re: Batch file for Visual Studio b
uild,

> > PPS. C programmers learning C++ and implementing there first C++
> driver will screw-up
> >big time.
>
> Exactly. To practice C++, there are better things, like user-mode MFC
> and ATL libraries.
>
> Max
>
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@amurshipyard.ru
> To unsubscribe send a blank email to %%email.unsub%%
>

Surely, I and I personally decided that C++ is not suitable for
system-level things, though fine for UI, database, web and common
component development tasks.

BTW - I would very, very much recommend ATL source as an advanced
tutorial in both C++ and COM.

Max

----- Original Message -----
From: “Andrew Sloven”
To: “NT Developers Interest List”
Sent: Monday, October 21, 2002 2:30 AM
Subject: [ntdev] Re: C++ in kernel. was Re: Batch file for Visual
Studio b uild,

> No doubts. I think that if I’m good in C++, I won’t ask anyone if is
it good
> or bad to use C++ anywhere. It’s up to programmer to decide under
which
> circumstances to use certain language.
>
> /regards/
>
> ----- Original Message -----
> From: “Maxim S. Shatskih”
> To: “NT Developers Interest List”
> Sent: Sunday, October 20, 2002 11:19 PM
> Subject: [ntdev] Re: C++ in kernel. was Re: Batch file for Visual
Studio b
> uild,
>
>
> > > PPS. C programmers learning C++ and implementing there first C++
> > driver will screw-up
> > >big time.
> >
> > Exactly. To practice C++, there are better things, like user-mode
MFC
> > and ATL libraries.
> >
> > Max
> >
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as:
xxxxx@amurshipyard.ru
> > To unsubscribe send a blank email to %%email.unsub%%
> >
>
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to %%email.unsub%%
>