C++ support lib for kernel?

+1

As one who reviews more code than he writes, I recommend that one never
underestimate the creative ways that junior programmers will find to (ab)use
language features. IMHO the language should be ‘safe’ like C# or ‘simple’
like C. Understanding that neither of these adjectives are truisms for the
citied languages, C++ is obviously more complex than C and obviously less
safe than C# (BTW C# is also less complicated because of the restrictions on
multiple inheritance etc.). IMHO this makes C++ a poor choice for any
project that isn’t written exclusively by experts.

“Maxim S. Shatskih” wrote in message news:xxxxx@ntdev…

Amen, not just the first ones either. I have witnessed such examples. I
even
hated anything C++ for years because the people using it said they were
superior
people compared to C people. They claimed object orientation meant they
would
write code twice as fast, they would have no bugs making QA irrelevant.

Ha-ha-ha. Abused C++ makes the potential for extremely hard to find bugs,
which are much worse then most C bugs.

Also, such people (my bosses were such in early 1990ies, and so was I, we
were all young, and yes, C++ was young too) often do not understand that
C++ is a paradigm mix of OOP and ADT/metaprogramming
, that some features
belong to OO and some to ADT, and mixing OO+ADT styles in the same program
produces even more mess then C’s spaghetti.

Sutter and Alexandrescu understand this well, but not all people write C++
code in conformance with their recommendations.

For instance: not all classes are suitable to be base classes (base class is
an OO notion), especially STL containers do not (STL is an ADT thing).

Beware of inheritance, it produces the fragile base class bugs which are by
far harder to fix
then C-style spaghetti bugs.

And yes, people like my bosses and I in early 1990ies were writing copy
constructors with updates to the original object
, implementing the B-tree
page split function as copy constructor. Yes, this is bad style.

Even here on this list somebody suggests to inherit from a template which
defines operator new/delete. Evil. For the correct way, see how std::vector
uses std::allocator.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

+1

Not only written by experts but somehow being assured it will be
maintained by experts. Some of the worst kernel code I have ever seen
started out as very clean C++ by experts, but as it moved from initial
development to feature addition it got dev’s who were less expert, by
the time it hit sustaining engineering, the company was planning on
rewriting it completely back to C.

Don Burn (MVP, Windows DKD)
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr

“m” wrote in message news:xxxxx@ntdev:

> +1
>
> As one who reviews more code than he writes, I recommend that one never
> underestimate the creative ways that junior programmers will find to (ab)use
> language features. IMHO the language should be ‘safe’ like C# or ‘simple’
> like C. Understanding that neither of these adjectives are truisms for the
> citied languages, C++ is obviously more complex than C and obviously less
> safe than C# (BTW C# is also less complicated because of the restrictions on
> multiple inheritance etc.). IMHO this makes C++ a poor choice for any
> project that isn’t written exclusively by experts.
>

> Then it have changed since the Stroustrup/Ellis book which I have cited above

The ability to direct new to also zero out is relatively recent. I have found almost no use for this feature in user mode. However, I use it heavily in drivers since the nature of many api’s is to zero out a chunk of dynamic memory, fill in a few things, then pass it. I recall a Stroustrup presentation some years ago where he expressed an interest in guiding the future of C++ to being well suited to drivers so that’s perhaps one he slipped in there for us.