Modern C++ Features in Kernel Mode Drivers

Hi All…

This is my annual lamentation, or pursuit of my personal holy grail if you will, about the chances of our seeing anything like modern C++ in the Kernel during my lifetime.

Back last year, we had SOME glimmer of sunshine from Mr. Tippett:

http:

And since then, well… the Visual Studio C++ compiler has gotten better (it’s C++ 17 compliant now) and C++ 20 has promised us even more cool shit like contracts (see Herb Sutter’s recent blog post on this topic).

But I still don’t see much hope for us on the kernel-mode front.

Why CAN’T we use std::unique_ptr, for example? Will static initializers ever get called? Will my dreams of using std::vector in my driver ever be fulfilled?

Anybody have any new insight/experience/whining to share?

Oh… It’s hardly thrilling, but… you can use C++ 17 attribute specifiers. So… you can now officially thrill yourself and put [[fallthrough]] in your case statements.

Sigh…

Peter
OSR
@OSRDrivers</http:>

Freestanding proposal: http://wg21.link/p0829
Leaving no room for a lower-level language: A C++ Subset: http://wg21.link/p1105

Why CAN’T we use std::unique_ptr, for example?
If my paper gets accepted, you will always be able to use unique_ptr with a custom delete, and likely be able to use it if you define your own new and delete (as you currently need to do with /KERNEL turned on)

Will static initializers ever get called?
My papers make no guarantee of that. The trick is figuring out when the right time is for that. I’d love to be able to (portably) invoke them at a time of my choosing. It is possible to do so non-portably right now though.

Will my dreams of using std::vector in my driver ever be fulfilled?
Maybe if we get zero-overhead deterministic exceptions. http://wg21.link/p0709
Seems more like a C++23 or 26 thing though.

-----Original Message-----
From: xxxxx@lists.osr.com > xxxxx@lists.osr.com> On Behalf Of xxxxx@osr.com
> Sent: Friday, July 6, 2018 4:07 PM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] Modern C++ Features in Kernel Mode Drivers
>
> Hi All…
>
> This is my annual lamentation, or pursuit of my personal holy grail if you will,
> about the chances of our seeing anything like modern C++ in the Kernel
> during my lifetime.
>
> Back last year, we had SOME glimmer of sunshine from Mr. Tippett:
>
> https:> 3A__www.osronline.com_showThread.CFM-3Flink-
> 3D284723&d=DwICAg&c=I_0YwoKy7z5LMTVdyO6YCiE2uzI1jjZZuIPelcSjixA&r
> =y8mub81SfUi-UCZRX0Vl1g&m=CiCi_lxTApD0ahGZg55NzULDFJlosN7We-
> OmYOXy_ZA&s=UlBAtlq8sZ1_pg8Pc7DaXsKhQqjTm930YElQi37ClE0&e=>
>
> And since then, well… the Visual Studio C++ compiler has gotten better (it’s
> C++ 17 compliant now) and C++ 20 has promised us even more cool shit like
> contracts (see Herb Sutter’s recent blog post on this topic).
>
> But I still don’t see much hope for us on the kernel-mode front.
>
> Why CAN’T we use std::unique_ptr, for example? Will static initializers ever
> get called? Will my dreams of using std::vector in my driver ever be fulfilled?
>
> Anybody have any new insight/experience/whining to share?
>
> Oh… It’s hardly thrilling, but… you can use C++ 17 attribute specifiers. So…
> you can now officially thrill yourself and put [[fallthrough]] in your case
> statements.
>
> Sigh…
>
> Peter
> OSR
> @OSRDrivers
>
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list online at: https:> 3A__www.osronline.com_showlists.cfm-3Flist-
> 3Dntdev&d=DwICAg&c=I_0YwoKy7z5LMTVdyO6YCiE2uzI1jjZZuIPelcSjixA&r=
> y8mub81SfUi-UCZRX0Vl1g&m=CiCi_lxTApD0ahGZg55NzULDFJlosN7We-
> OmYOXy_ZA&s=um2qqAKQ0CO2IeGu6eP_fhT2hCxMMr0kkcYZCfTlxIY&e=>
>
> MONTHLY seminars on crash dump analysis, WDF, Windows internals and
> software drivers!
> Details at https:> 3A www.osr.com_seminars&d=DwICAg&c=I_0YwoKy7z5LMTVdyO6YCiE2u
> zI1jjZZuIPelcSjixA&r=y8mub81SfUi-
> UCZRX0Vl1g&m=CiCi_lxTApD0ahGZg55NzULDFJlosN7We-
> OmYOXy_ZA&s=tcCkJt6CRop9GcslH_0gyb8CRVwpQQml1BVUvTY91LY&e=>
>
> To unsubscribe, visit the List Server section of OSR Online at
> https:> 3A
www.osronline.com_page.cfm-3Fname-
> 3DListServer&d=DwICAg&c=I_0YwoKy7z5LMTVdyO6YCiE2uzI1jjZZuIPelcSjixA
> &r=y8mub81SfUi-UCZRX0Vl1g&m=CiCi_lxTApD0ahGZg55NzULDFJlosN7We-
> OmYOXy_ZA&s=4suR06mhclSP1KXWNdKDvzwg-
> DbNcZXkhC4daaPe2bU&e=></https:></https:></https:></https:>

It is tempting to think C++ can provide you some advantage in the kernel,
and I have tried to use it. It ends up being a total mess. I’ve come to the
conclusion that if you think yo need C++ in your driver, maybe you need to
rethink your design. Maybe one exception would be a file system, but I
doubt it. In fact, I end up turning off some of the more nagging defaults
in Visual C++ when doing kernel work because I like being able to
initialize a structure when it is instantiated:

LARGE_INTEGER x = { .QuadPart = 1000000 };

to me is better than

LARGE_INTEGER x;
x.QuadPart = 1000000;

The former is not allowed in C++

On Fri, Jul 6, 2018 at 5:27 PM prvs=67257ae4b8=ben.craig@ni.com <
xxxxx@lists.osr.com> wrote:

Freestanding proposal: http://wg21.link/p0829
Leaving no room for a lower-level language: A C++ Subset:
http://wg21.link/p1105

> Why CAN’T we use std::unique_ptr, for example?
If my paper gets accepted, you will always be able to use unique_ptr with
a custom delete, and likely be able to use it if you define your own new
and delete (as you currently need to do with /KERNEL turned on)

> Will static initializers ever get called?
My papers make no guarantee of that. The trick is figuring out when the
right time is for that. I’d love to be able to (portably) invoke them at a
time of my choosing. It is possible to do so non-portably right now though.

> Will my dreams of using std::vector in my driver ever be fulfilled?
Maybe if we get zero-overhead deterministic exceptions.
http://wg21.link/p0709
Seems more like a C++23 or 26 thing though.

> -----Original Message-----
> From: xxxxx@lists.osr.com > > xxxxx@lists.osr.com> On Behalf Of xxxxx@osr.com
> > Sent: Friday, July 6, 2018 4:07 PM
> > To: Windows System Software Devs Interest List
> > Subject: [ntdev] Modern C++ Features in Kernel Mode Drivers
> >
> > Hi All…
> >
> > This is my annual lamentation, or pursuit of my personal holy grail if
> you will,
> > about the chances of our seeing anything like modern C++ in the Kernel
> > during my lifetime.
> >
> > Back last year, we had SOME glimmer of sunshine from Mr. Tippett:
> >
> > https:> > 3A__www.osronline.com_showThread.CFM-3Flink-
> > 3D284723&d=DwICAg&c=I_0YwoKy7z5LMTVdyO6YCiE2uzI1jjZZuIPelcSjixA&r
> > =y8mub81SfUi-UCZRX0Vl1g&m=CiCi_lxTApD0ahGZg55NzULDFJlosN7We-
> > OmYOXy_ZA&s=UlBAtlq8sZ1_pg8Pc7DaXsKhQqjTm930YElQi37ClE0&e=>
> >
> > And since then, well… the Visual Studio C++ compiler has gotten better
> (it’s
> > C++ 17 compliant now) and C++ 20 has promised us even more cool shit like
> > contracts (see Herb Sutter’s recent blog post on this topic).
> >
> > But I still don’t see much hope for us on the kernel-mode front.
> >
> > Why CAN’T we use std::unique_ptr, for example? Will static initializers
> ever
> > get called? Will my dreams of using std::vector in my driver ever be
> fulfilled?
> >
> > Anybody have any new insight/experience/whining to share?
> >
> > Oh… It’s hardly thrilling, but… you can use C++ 17 attribute
> specifiers. So…
> > you can now officially thrill yourself and put [[fallthrough]] in your
> case
> > statements.
> >
> > Sigh…
> >
> > Peter
> > OSR
> > @OSRDrivers
> >
> >
> > —
> > NTDEV is sponsored by OSR
> >
> > Visit the list online at: <
> https://urldefense.proofpoint.com/v2/url?u=http-
> > 3A__www.osronline.com_showlists.cfm-3Flist-
> > 3Dntdev&d=DwICAg&c=I_0YwoKy7z5LMTVdyO6YCiE2uzI1jjZZuIPelcSjixA&r=
> > y8mub81SfUi-UCZRX0Vl1g&m=CiCi_lxTApD0ahGZg55NzULDFJlosN7We-
> > OmYOXy_ZA&s=um2qqAKQ0CO2IeGu6eP_fhT2hCxMMr0kkcYZCfTlxIY&e=>
> >
> > MONTHLY seminars on crash dump analysis, WDF, Windows internals and
> > software drivers!
> > Details at https:> > 3A www.osr.com_seminars&d=DwICAg&c=I_0YwoKy7z5LMTVdyO6YCiE2u
> > zI1jjZZuIPelcSjixA&r=y8mub81SfUi-
> > UCZRX0Vl1g&m=CiCi_lxTApD0ahGZg55NzULDFJlosN7We-
> > OmYOXy_ZA&s=tcCkJt6CRop9GcslH_0gyb8CRVwpQQml1BVUvTY91LY&e=>
> >
> > To unsubscribe, visit the List Server section of OSR Online at
> > https:> > 3A
www.osronline.com_page.cfm-3Fname-
> > 3DListServer&d=DwICAg&c=I_0YwoKy7z5LMTVdyO6YCiE2uzI1jjZZuIPelcSjixA
> > &r=y8mub81SfUi-UCZRX0Vl1g&m=CiCi_lxTApD0ahGZg55NzULDFJlosN7We-
> > OmYOXy_ZA&s=4suR06mhclSP1KXWNdKDvzwg-
> > DbNcZXkhC4daaPe2bU&e=>
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list online at: <
> http://www.osronline.com/showlists.cfm?list=ntdev&gt;
>
> MONTHLY seminars on crash dump analysis, WDF, Windows internals and
> software drivers!
> Details at http:
>
> To unsubscribe, visit the List Server section of OSR Online at <
> http://www.osronline.com/page.cfm?name=ListServer&gt;
>


Jamey Kirby
Disrupting the establishment since 1964

This is a personal email account and as such, emails are not subject to
archiving. Nothing else really matters.
</http:></https:></https:></https:>

I’ve used C++ mainly in user mode, like daemon, NT services etc. Used (pure) virtual, etc mostly on C99++, only used some lambda, unique_pointer/shared_pointer etc. So I’m not like expert on this language. Most of the time, I look at design patterns, try to map a problem at hand to it. In fact I used few patterns to achieve complex design ( which is bit far from language bloating - like seeing 10 + levels of lambdas ). Also I read, whenever needed Mr Herb, and others book to understand what I need at time….

Now my take is for kernel mode components — What are the likely ADTs ( stack, Q/Deque, list, string etc) needed for kernel side ? Long back I read exceptional C++. Yes if any code has littered with try/catch, most likely an easy path to suppress some bugs (either not fully understood, or corner cases, once in a blue moon — these are good terms to convince managers :slight_smile: ). And also the book says — It is difficult to write exception safe C++ code, and that was then, time is now. I don’t know if situation changed on this exception front.

But KPI/DDK, etc are coming up with fairly ready made ADTs etc. So one can use C, with those added library.

GCC/LLVM now have so many attributes and VS has SAL etc. So there is an ongoing refinements language level helps, but using the appropriate combination is not.

Many a time, I’ve seen or was told by others about C++ experts in the team. When I see the code, well of course much later, I get displeasure.

It’s perhaps me…

Once there is a comprehensive book about how to write kernel code in C++ comes out I will surely read, and read again.

-Pro

On Jul 6, 2018, at 3:15 PM, xxxxx@gmail.com wrote:
>
> It is tempting to think C++ can provide you some advantage in the kernel, and I have tried to use it. It ends up being a total mess. I’ve come to the conclusion that if you think yo need C++ in your driver, maybe you need to rethink your design. Maybe one exception would be a file system, but I doubt it. In fact, I end up turning off some of the more nagging defaults in Visual C++ when doing kernel work because I like being able to initialize a structure when it is instantiated:
>
> LARGE_INTEGER x = { .QuadPart = 1000000 };
>
> to me is better than
>
> LARGE_INTEGER x;
> x.QuadPart = 1000000;
>
> The former is not allowed in C++
>
>
>
>
>
> On Fri, Jul 6, 2018 at 5:27 PM prvs=67257ae4b8=ben.craig@ni.com mailto:ben.craig > wrote:
> Freestanding proposal: http://wg21.link/p0829 http:
> Leaving no room for a lower-level language: A C++ Subset: http://wg21.link/p1105 http:
>
> > Why CAN’T we use std::unique_ptr, for example?
> If my paper gets accepted, you will always be able to use unique_ptr with a custom delete, and likely be able to use it if you define your own new and delete (as you currently need to do with /KERNEL turned on)
>
> > Will static initializers ever get called?
> My papers make no guarantee of that. The trick is figuring out when the right time is for that. I’d love to be able to (portably) invoke them at a time of my choosing. It is possible to do so non-portably right now though.
>
> > Will my dreams of using std::vector in my driver ever be fulfilled?
> Maybe if we get zero-overhead deterministic exceptions. http://wg21.link/p0709 http:
> Seems more like a C++23 or 26 thing though.
>
>
>
> > -----Original Message-----
> > From: xxxxx@lists.osr.com mailto:xxxxx > > xxxxx@lists.osr.com mailto:xxxxx> On Behalf Of xxxxx@osr.com mailto:xxxxx
> > Sent: Friday, July 6, 2018 4:07 PM
> > To: Windows System Software Devs Interest List >
> > Subject: [ntdev] Modern C++ Features in Kernel Mode Drivers
> >
> > Hi All…
> >
> > This is my annual lamentation, or pursuit of my personal holy grail if you will,
> > about the chances of our seeing anything like modern C++ in the Kernel
> > during my lifetime.
> >
> > Back last year, we had SOME glimmer of sunshine from Mr. Tippett:
> >
> > https:
> > 3A__www.osronline.com_showThread.CFM-3Flink-
> > 3D284723&d=DwICAg&c=I_0YwoKy7z5LMTVdyO6YCiE2uzI1jjZZuIPelcSjixA&r
> > =y8mub81SfUi-UCZRX0Vl1g&m=CiCi_lxTApD0ahGZg55NzULDFJlosN7We-
> > OmYOXy_ZA&s=UlBAtlq8sZ1_pg8Pc7DaXsKhQqjTm930YElQi37ClE0&e=>
> >
> > And since then, well… the Visual Studio C++ compiler has gotten better (it’s
> > C++ 17 compliant now) and C++ 20 has promised us even more cool shit like
> > contracts (see Herb Sutter’s recent blog post on this topic).
> >
> > But I still don’t see much hope for us on the kernel-mode front.
> >
> > Why CAN’T we use std::unique_ptr, for example? Will static initializers ever
> > get called? Will my dreams of using std::vector in my driver ever be fulfilled?
> >
> > Anybody have any new insight/experience/whining to share?
> >
> > Oh… It’s hardly thrilling, but… you can use C++ 17 attribute specifiers. So…
> > you can now officially thrill yourself and put [[fallthrough]] in your case
> > statements.
> >
> > Sigh…
> >
> > Peter
> > OSR
> > @OSRDrivers
> >
> >
> > —
> > NTDEV is sponsored by OSR
> >
> > Visit the list online at: https:
> > 3A__www.osronline.com_showlists.cfm-3Flist-
> > 3Dntdev&d=DwICAg&c=I_0YwoKy7z5LMTVdyO6YCiE2uzI1jjZZuIPelcSjixA&r=
> > y8mub81SfUi-UCZRX0Vl1g&m=CiCi_lxTApD0ahGZg55NzULDFJlosN7We-
> > OmYOXy_ZA&s=um2qqAKQ0CO2IeGu6eP_fhT2hCxMMr0kkcYZCfTlxIY&e=>
> >
> > MONTHLY seminars on crash dump analysis, WDF, Windows internals and
> > software drivers!
> > Details at https:
> > 3A www.osr.com_seminars&d=DwICAg&c=I_0YwoKy7z5LMTVdyO6YCiE2u
> > zI1jjZZuIPelcSjixA&r=y8mub81SfUi-
> > UCZRX0Vl1g&m=CiCi_lxTApD0ahGZg55NzULDFJlosN7We-
> > OmYOXy_ZA&s=tcCkJt6CRop9GcslH_0gyb8CRVwpQQml1BVUvTY91LY&e=>
> >
> > To unsubscribe, visit the List Server section of OSR Online at
> > https:
> > 3A
www.osronline.com_page.cfm-3Fname-
> > 3DListServer&d=DwICAg&c=I_0YwoKy7z5LMTVdyO6YCiE2uzI1jjZZuIPelcSjixA
> > &r=y8mub81SfUi-UCZRX0Vl1g&m=CiCi_lxTApD0ahGZg55NzULDFJlosN7We-
> > OmYOXy_ZA&s=4suR06mhclSP1KXWNdKDvzwg-
> > DbNcZXkhC4daaPe2bU&e=>
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list online at: http:>
>
> MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers!
> Details at http:>
>
> To unsubscribe, visit the List Server section of OSR Online at http:>
>
>
> –
> Jamey Kirby
> Disrupting the establishment since 1964
>
> This is a personal email account and as such, emails are not subject to archiving. Nothing else really matters.
> — NTDEV is sponsored by OSR Visit the list online at: MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers! Details at To unsubscribe, visit the List Server section of OSR Online at</http:></http:></http:></https:></https:></https:></https:></mailto:xxxxx></mailto:xxxxx></mailto:xxxxx></http:></http:></http:></mailto:ben.craig>

And I?ll give my usual refrain in reply ? why would you want it

I am old and full of vitriol, but I have worked on a vast array or projects across different disciplines over the years. Earlier today I had to explain to a new hire that yes, x86 (although numerically superior) is actually older than x64 and I have been conscripted to fix and ASP.NET API. Last month I was working on a Cobol extract in EBCIDIC from AS 400. I?m sure I forget half of the stuff, but in addition to KM programming in Windows and Linux, I?ve worked with at least two dozen languages over the years solving all sorts of problems.

One starts to see patterns after a time.

Assuming that one has a goal oriented view of the world, then which is the better goal to have:

  1. My life as a developer is easier; or
  2. The quality of the work produced by my efforts is higher

One might argue that #2 is achieved by default by satisfying #1 (as Peter has done in his other thread RE MSFT engagement) , but which one is the higher goal? The goal of sloth or of achievement?

Assuming then that we want to achieve things, we are looking for tools that will help us achieve.

A ?high level? language like C helps us to achieve versus writing in assembly language because there is an obvious transmutation ? we change the whole paradigm of how we work from registers and addresses into variables and structures. Yes there are some kinds of algorithms which cannot be as effectively written in C as in ASM, but they are few.

An even higher level language like C# helps us achieve versus writing in C (or assembly language) because there another obvious transmutation ? again we change the whole paradigm of how we work. In this case it is all about memory management in the error cases

An event higher level language like TSQL helps us achieve by allowing us to express the DDL or DML operations of interest without having to specify how those operations will be carried our (lots of this has come to C# to via LINQ)

And then we go into the goofy land of Excel MACRO?s, power shell scripts, and the plethora of web service techniques. Not that they are bad per se, just that they are the top of the pyramid.

On this pyramid there are many ugly duckling steps and C++ is the most notable of them all. It is a neither nor language and has all of the faults of the step below without all of the benefits of the step above. There are many others with the same problem and it is not a knock on C++ just because it is more famous.

In point of fact I am presently engaged in a support incident with MSFT that stems from their use of C++ in an ODBC driver. We call the C API on the upper edge (as per the ODBC standard) and they call the C win32 API on the lower edge, but in the middle, their code does not handle all possible errors correctly and C++ exceptions ?leak? out of the top edge back into my code. The support lead has reviewed the source code and confirmed a bug in the MSFT code, but they presently don?t plan to fix it because the cost of testing the change would be too high unless I can demonstrate this is in fact not the ?one in a million? that they think it is by producing a pattern of crash dumps from our real world application failing.

At this point, I might need my own pontification, but if anyone is still reading, a further important consideration not often discussed, is the quality of run time library support. The CRT is a very poor library overall versus the stock code available for C++. That does not make C++ as a language better, but it can reduce the work that someone needs to do to write a particular program. Similarly, C# has as extensive runtime library that finally supports (with LINQ and the concurrent generics) a proper decent set of data structures and algorithms. Exactly the same kind of support can (and has at least by me) be written in C. As an aside, looking at the .NET reference source is an eye opening activity ? many of the implementations are shockingly bad

I am old and my vitriol is ebbing with this much venting. Hopefully it will be of some help to some one to read this

Sent from Mailhttps: for Windows 10

________________________________
From: xxxxx@lists.osr.com on behalf of xxxxx@osr.com
Sent: Friday, July 6, 2018 5:06:41 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Modern C++ Features in Kernel Mode Drivers

Hi All…

This is my annual lamentation, or pursuit of my personal holy grail if you will, about the chances of our seeing anything like modern C++ in the Kernel during my lifetime.

Back last year, we had SOME glimmer of sunshine from Mr. Tippett:

http:

And since then, well… the Visual Studio C++ compiler has gotten better (it’s C++ 17 compliant now) and C++ 20 has promised us even more cool shit like contracts (see Herb Sutter’s recent blog post on this topic).

But I still don’t see much hope for us on the kernel-mode front.

Why CAN’T we use std::unique_ptr, for example? Will static initializers ever get called? Will my dreams of using std::vector in my driver ever be fulfilled?

Anybody have any new insight/experience/whining to share?

Oh… It’s hardly thrilling, but… you can use C++ 17 attribute specifiers. So… you can now officially thrill yourself and put [[fallthrough]] in your case statements.

Sigh…

Peter
OSR
@OSRDrivers


NTDEV is sponsored by OSR

Visit the list online at: http:

MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers!
Details at http:

To unsubscribe, visit the List Server section of OSR Online at http:</http:></http:></http:></http:></https:>

Never fails does it? Every time this discussion comes up instead of talking about c++ people talk about their own deficiencies and shortcomings. It would be like opening a topic on C and the naysayers come out of the woodwork whining about how they made spaghetti code, tried to pass arguments that took too much stack space or how a runtime library function didn’t work and their code is always complete garbage. Then they tell us how interpretive BASIC is such a superior language and C should be banned. Meanwhile the rest are happily using C and “just don’t get it” with these people who hate C.

Same thing here. For the benefit of the reader I would like to provide some balance to say there absolutely are plenty of us who use c++ happily in the kernel as our greatest asset. It makes for simpler, cleaner, more elegant code, quicker product cycles, higher quality. Yes the grass really is greener for us. It’s actually a good thing there are all these people that can’t use it right and advertise their deficiencies here. It gives the others a competitive edge to lock in more customers and higher margins.

And I would wager the people that hate c++ haven’t the slightest idea what is in c++17 or c++20 but they still hate it anyway, every single bit of it. Weird people who the rest of us can easily see are painting with too wide a brush.

No, not really …

Abstraction has levels. From ASM to C was a clear indicator. One can feel, smell, see, observe, once someone spend at least 5 years just dribbling with ASM. From C++ to C ( in the kernel ), with specification or order ( don’t use this, don’t use that, have your new(), delete() etc ), with FAT follower of BOOST so that we can have say included or some such.

Exactly how many years went by, after C kernel came, and how many major platforms’ kernel are still in C ??? To be exact first incarnation was in Mid 70s. Almost 50 years — I guess those kernel guys are lousy and worthless, right?

If some one does foul up left and right getting some ADTs right because of pointers etc., they would be called poindexter, as I was named.

Please be happy with what you use - just don’t preach, it does not work.

There has to be comprehensive set of books that would clearly spell out the advantages ( not just using std:: ). Ease of use, easy to learn, image footprint, performances etc.

The machine abstraction(s) are right there at C level ( no more / no less ). Those who have passion for work, almost never write bloated / convoluted code - Be it asm, C, C++ or any languages.

The first principle —- short, simple, clear. Language would not matter ( when it comes to C or C++ ).

-Pro

> On Jul 6, 2018, at 5:02 PM, xxxxx@gmail.com wrote:
>
> Never fails does it? Every time this discussion comes up instead of talking about c++ people talk about their own deficiencies and shortcomings. It would be like opening a topic on C and the naysayers come out of the woodwork whining about how they made spaghetti code, tried to pass arguments that took too much stack space or how a runtime library function didn’t work and their code is always complete garbage. Then they tell us how interpretive BASIC is such a superior language and C should be banned. Meanwhile the rest are happily using C and “just don’t get it” with these people who hate C.
>
> Same thing here. For the benefit of the reader I would like to provide some balance to say there absolutely are plenty of us who use c++ happily in the kernel as our greatest asset. It makes for simpler, cleaner, more elegant code, quicker product cycles, higher quality. Yes the grass really is greener for us. It’s actually a good thing there are all these people that can’t use it right and advertise their deficiencies here. It gives the others a competitive edge to lock in more customers and higher margins.
>
> And I would wager the people that hate c++ haven’t the slightest idea what is in c++17 or c++20 but they still hate it anyway, every single bit of it. Weird people who the rest of us can easily see are painting with too wide a brush.
>
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list online at: http:
>
> MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers!
> Details at http:
>
> To unsubscribe, visit the List Server section of OSR Online at http:</http:></http:></http:>

xxxxx@gmail.com wrote:

It is tempting to think C++ can provide you some advantage in the
kernel, and I have tried to use it. It ends up being a total mess.
I’ve come to the conclusion that if you think yo need C++ in your
driver, maybe you need to rethink your design.

That’s just religious nonsense.  If you’re not a C++ coder most of the
time, then of course you’re going to fail when you try to wedge it into
a kernel driver.

C++ just lets one express many concepts in a simpler, more natural, and
less error-prone way than C does.  It’s not about “needing” C++.  It’s
about using a language that allows me to express myself more naturally.

In fact, I end up turning off some of the more nagging defaults in
Visual C++ when doing kernel work because I like being able to
initialize a structure when it is instantiated:

LARGE_INTEGER x = { .QuadPart = 1000000 };

to me is better than

LARGE_INTEGER x;
x.QuadPart = 1000000;

The former is not allowed in C++

Well, with Visual C++, it hasn’t been allowed in C for very long.  This
gcc extension was adopted into the C99 standard, but Visual C++ still
only implements a few parts of C99.  Designated initializers only
arrived in VS 2013.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

?natural? to whom? To you?

Let me know what you think can be better done in C++ than any other language and I?ll give you an immediate counter example. I guarantee it.

Its isn?t that C++ is bad, it is just that it is a neither nor language and the runtime support which would seem to be a good reason to choose the language is not even specific to the language itself ? but happens to be written in it

Sent from Mailhttps: for Windows 10

________________________________
From: xxxxx@lists.osr.com on behalf of xxxxx@probo.com
Sent: Friday, July 6, 2018 9:06:16 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Modern C++ Features in Kernel Mode Drivers

xxxxx@gmail.com wrote:
>
> It is tempting to think C++ can provide you some advantage in the
> kernel, and I have tried to use it. It ends up being a total mess.
> I’ve come to the conclusion that if you think yo need C++ in your
> driver, maybe you need to rethink your design.

That’s just religious nonsense. If you’re not a C++ coder most of the
time, then of course you’re going to fail when you try to wedge it into
a kernel driver.

C++ just lets one express many concepts in a simpler, more natural, and
less error-prone way than C does. It’s not about “needing” C++. It’s
about using a language that allows me to express myself more naturally.

> In fact, I end up turning off some of the more nagging defaults in
> Visual C++ when doing kernel work because I like being able to
> initialize a structure when it is instantiated:
>
> LARGE_INTEGER x = { .QuadPart = 1000000 };
>
> to me is better than
>
> LARGE_INTEGER x;
> x.QuadPart = 1000000;
>
> The former is not allowed in C++

Well, with Visual C++, it hasn’t been allowed in C for very long. This
gcc extension was adopted into the C99 standard, but Visual C++ still
only implements a few parts of C99. Designated initializers only
arrived in VS 2013.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.


NTDEV is sponsored by OSR

Visit the list online at: http:

MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers!
Details at http:

To unsubscribe, visit the List Server section of OSR Online at http:</http:></http:></http:></https:>

There are two accounts on languages and computing that I would take the liberty to mention here —-

  1. By Kennith Anderson, about APL. There are few fairly long YouTube Videos out there about it. When the specification was out, he new people would ask about its implementation example. He had time-sharing system written on top of VM. But he never vouched to write an OS. In fact, opposed it :slight_smile:

  2. There was Dr. Dobbs Journal interview with Ken Thomson. He mentioned , when asked about C and C++ back when he joined Google, that
    Stroustrup kept insisting him to use C++. He said, it is too complex for me, and never bought the idea of using it.

And for C++ lovers ( in the kernel ), who thinks I’m a C++ hater —-

  1. There was a need to write few infrastructures at daemon level that is mainly written in C
    A) A thread pool ( pthread lib interface requires bit of a code, and we had it already in C)
    B) An abstraction of TCP Stream, instead of socket level client & server ( again we had C code already )
    C) A logger library to concurrently Log to File/Console/Network Client ( with different Levels )
    D) A C++ library to provide interface to 3rd Part Libraries and C interface to daemon.

All are in C++, except the C interface.

When it comes down to kernel, I completely take my C hat, and move on. Thankfully, lately I wrote quite a bit of kernel codes.

So there I’m …

-Pro

On Jul 6, 2018, at 6:18 PM, xxxxx@hotmail.com wrote:
>
> ‘natural’ to whom? To you?
>
> Let me know what you think can be better done in C++ than any other language and I’ll give you an immediate counter example. I guarantee it.
>
> Its isn’t that C++ is bad, it is just that it is a neither nor language and the runtime support which would seem to be a good reason to choose the language is not even specific to the language itself – but happens to be written in it
>
> Sent from Mail for Windows 10
>
> From: xxxxx@lists.osr.com on behalf of xxxxx@probo.com
> Sent: Friday, July 6, 2018 9:06:16 PM
> To: Windows System Software Devs Interest List
> Subject: Re: [ntdev] Modern C++ Features in Kernel Mode Drivers
>
> xxxxx@gmail.com wrote:
> >
> > It is tempting to think C++ can provide you some advantage in the
> > kernel, and I have tried to use it. It ends up being a total mess.
> > I’ve come to the conclusion that if you think yo need C++ in your
> > driver, maybe you need to rethink your design.
>
> That’s just religious nonsense. If you’re not a C++ coder most of the
> time, then of course you’re going to fail when you try to wedge it into
> a kernel driver.
>
> C++ just lets one express many concepts in a simpler, more natural, and
> less error-prone way than C does. It’s not about “needing” C++. It’s
> about using a language that allows me to express myself more naturally.
>
>
> > In fact, I end up turning off some of the more nagging defaults in
> > Visual C++ when doing kernel work because I like being able to
> > initialize a structure when it is instantiated:
> >
> > LARGE_INTEGER x = { .QuadPart = 1000000 };
> >
> > to me is better than
> >
> > LARGE_INTEGER x;
> > x.QuadPart = 1000000;
> >
> > The former is not allowed in C++
>
> Well, with Visual C++, it hasn’t been allowed in C for very long. This
> gcc extension was adopted into the C99 standard, but Visual C++ still
> only implements a few parts of C99. Designated initializers only
> arrived in VS 2013.
>
> –
> Tim Roberts, xxxxx@probo.com
> Providenza & Boekelheide, Inc.
>
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list online at: http:
>
> MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers!
> Details at http:
>
> To unsubscribe, visit the List Server section of OSR Online at http:
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list online at: http:
>
> MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers!
> Details at http:
>
> To unsubscribe, visit the List Server section of OSR Online at http:</http:></http:></http:></http:></http:></http:>

>> That’s just religious nonsense.

No it is not.

I started writing C++ code back in Borland C++ under DOS, so it has nothing
to do with knowing C++, the standards, or how the language works, and I’ve
done my share of Windows C++ in user-mode. C++ is OK for large projects
where abstraction can shine. In the kernel, not so much.

It’s about the right tool for the job, and i’ve found using C++ in the
kernel much like watchmaking with a sledgehammer. Maybe when Microsoft
ships a WDK with classes around the common kernel features like lists,
generic tables, &c., i’ll have another look, but until then, i’ll stick to
C in the kernel.

On Fri, Jul 6, 2018 at 9:19 PM xxxxx@hotmail.com
wrote:

> ‘natural’ to whom? To you?
>
>
>
> Let me know what you think can be better done in C++ than any other
> language and I’ll give you an immediate counter example. I guarantee it.
>
>
>
> Its isn’t that C++ is bad, it is just that it is a neither nor language
> and the runtime support which would seem to be a good reason to choose the
> language is not even specific to the language itself – but happens to be
> written in it
>
>
>
> Sent from Mail https: for
> Windows 10
>
>
> ------------------------------
> From: xxxxx@lists.osr.com <
> xxxxx@lists.osr.com> on behalf of xxxxx@probo.com <
> xxxxx@lists.osr.com>
> Sent: Friday, July 6, 2018 9:06:16 PM
> To: Windows System Software Devs Interest List
> Subject: Re: [ntdev] Modern C++ Features in Kernel Mode Drivers
>
> xxxxx@gmail.com wrote:
> >
> > It is tempting to think C++ can provide you some advantage in the
> > kernel, and I have tried to use it. It ends up being a total mess.
> > I’ve come to the conclusion that if you think yo need C++ in your
> > driver, maybe you need to rethink your design.
>
> That’s just religious nonsense. If you’re not a C++ coder most of the
> time, then of course you’re going to fail when you try to wedge it into
> a kernel driver.
>
> C++ just lets one express many concepts in a simpler, more natural, and
> less error-prone way than C does. It’s not about “needing” C++. It’s
> about using a language that allows me to express myself more naturally.
>
>
> > In fact, I end up turning off some of the more nagging defaults in
> > Visual C++ when doing kernel work because I like being able to
> > initialize a structure when it is instantiated:
> >
> > LARGE_INTEGER x = { .QuadPart = 1000000 };
> >
> > to me is better than
> >
> > LARGE_INTEGER x;
> > x.QuadPart = 1000000;
> >
> > The former is not allowed in C++
>
> Well, with Visual C++, it hasn’t been allowed in C for very long. This
> gcc extension was adopted into the C99 standard, but Visual C++ still
> only implements a few parts of C99. Designated initializers only
> arrived in VS 2013.
>
> –
> Tim Roberts, xxxxx@probo.com
> Providenza & Boekelheide, Inc.
>
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list online at: <
> http://www.osronline.com/showlists.cfm?list=ntdev&gt;
>
> MONTHLY seminars on crash dump analysis, WDF, Windows internals and
> software drivers!
> Details at http:
>
> To unsubscribe, visit the List Server section of OSR Online at <
> http://www.osronline.com/page.cfm?name=ListServer&gt;
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list online at: <
> http://www.osronline.com/showlists.cfm?list=ntdev&gt;
>
> MONTHLY seminars on crash dump analysis, WDF, Windows internals and
> software drivers!
> Details at http:
>
> To unsubscribe, visit the List Server section of OSR Online at <
> http://www.osronline.com/page.cfm?name=ListServer&gt;
>


Jamey Kirby
Disrupting the establishment since 1964

This is a personal email account and as such, emails are not subject to
archiving. Nothing else really matters.
</http:></http:></https:>

Yes, I had fairly the same —- DLL, MFC vs. OWL, SOM vs. COM. And C++ was the main tool …

-Pro

On Jul 6, 2018, at 7:33 PM, xxxxx@gmail.com wrote:
>
> >> That’s just religious nonsense.
>
> No it is not.
>
> I started writing C++ code back in Borland C++ under DOS, so it has nothing to do with knowing C++, the standards, or how the language works, and I’ve done my share of Windows C++ in user-mode. C++ is OK for large projects where abstraction can shine. In the kernel, not so much.
>
> It’s about the right tool for the job, and i’ve found using C++ in the kernel much like watchmaking with a sledgehammer. Maybe when Microsoft ships a WDK with classes around the common kernel features like lists, generic tables, &c., i’ll have another look, but until then, i’ll stick to C in the kernel.
>
>
> On Fri, Jul 6, 2018 at 9:19 PM xxxxx@hotmail.com mailto:xxxxx > wrote:
> ‘natural’ to whom? To you?
>
>
> Let me know what you think can be better done in C++ than any other language and I’ll give you an immediate counter example. I guarantee it.
>
>
> Its isn’t that C++ is bad, it is just that it is a neither nor language and the runtime support which would seem to be a good reason to choose the language is not even specific to the language itself – but happens to be written in it
>
>
> Sent from Mail https: for Windows 10
>
>
> From: xxxxx@lists.osr.com mailto:xxxxx > on behalf of xxxxx@probo.com mailto:xxxxx >
> Sent: Friday, July 6, 2018 9:06:16 PM
> To: Windows System Software Devs Interest List
> Subject: Re: [ntdev] Modern C++ Features in Kernel Mode Drivers
>
> xxxxx@gmail.com mailto:xxxxx wrote:
> >
> > It is tempting to think C++ can provide you some advantage in the
> > kernel, and I have tried to use it. It ends up being a total mess.
> > I’ve come to the conclusion that if you think yo need C++ in your
> > driver, maybe you need to rethink your design.
>
> That’s just religious nonsense. If you’re not a C++ coder most of the
> time, then of course you’re going to fail when you try to wedge it into
> a kernel driver.
>
> C++ just lets one express many concepts in a simpler, more natural, and
> less error-prone way than C does. It’s not about “needing” C++. It’s
> about using a language that allows me to express myself more naturally.
>
>
> > In fact, I end up turning off some of the more nagging defaults in
> > Visual C++ when doing kernel work because I like being able to
> > initialize a structure when it is instantiated:
> >
> > LARGE_INTEGER x = { .QuadPart = 1000000 };
> >
> > to me is better than
> >
> > LARGE_INTEGER x;
> > x.QuadPart = 1000000;
> >
> > The former is not allowed in C++
>
> Well, with Visual C++, it hasn’t been allowed in C for very long. This
> gcc extension was adopted into the C99 standard, but Visual C++ still
> only implements a few parts of C99. Designated initializers only
> arrived in VS 2013.
>
> –
> Tim Roberts, xxxxx@probo.com mailto:xxxxx
> Providenza & Boekelheide, Inc.
>
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list online at: http:>
>
> MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers!
> Details at http:>
>
> To unsubscribe, visit the List Server section of OSR Online at http:>
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list online at: http:>
>
> MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers!
> Details at http:>
>
> To unsubscribe, visit the List Server section of OSR Online at http:>
>
>
> –
> Jamey Kirby
> Disrupting the establishment since 1964
>
> This is a personal email account and as such, emails are not subject to archiving. Nothing else really matters.
> — NTDEV is sponsored by OSR Visit the list online at: MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers! Details at To unsubscribe, visit the List Server section of OSR Online at</http:></http:></http:></http:></http:></http:></mailto:xxxxx></mailto:xxxxx></mailto:xxxxx></mailto:xxxxx></https:></mailto:xxxxx>

On Fri, Jul 6, 2018 at 5:15 PM, xxxxx@gmail.com
wrote:
> It is tempting to think C++ can provide you some advantage in the kernel,
> and I have tried to use it. It ends up being a total mess. I’ve come to the
> conclusion that if you think yo need C++ in your driver, maybe you need to
> rethink your design. Maybe one exception would be a file system, but I doubt
> it. In fact, I end up turning off some of the more nagging defaults in
> Visual C++ when doing kernel work because I like being able to initialize a
> structure when it is instantiated:
>

I originally did not like C++. I am not sure I do yet, but I realize
more its purpose. Too many people attempt to immediately use, almost
exclusively, heap memory. Modern language extensions make this a lot
safer but C++ is not Java or C#.

To me, it seems like C++ is best used as a language of “managed
structures.” You really want your class instances to be on the stack.
You can have all of the syntactic features of C++ with none of the
memory issues most people experience.

In this way C++ can be a very nice language, but admittedly a lot of
that is simply from the existence of namespaces and the ease of
associating code and data. Newer features like lambdas make C++
elegant in the same way as scripting languages without the runtime
penalty. The standard containers are also extremely useful.

There was a period of time where C++ developers were relying heavily
on C code and consequently wrote “C compiled with a C++ compiler.”
There was mostly no merit to this code using a C++ compiler, and when
features were used they tended to be used poorly. Now we are past that
point. Many C libraries have C++ bindings that provide class based
interfaces, etc.

> LARGE_INTEGER x = { .QuadPart = 1000000 };
>
> to me is better than
>
> LARGE_INTEGER x;
> x.QuadPart = 1000000;
>
> The former is not allowed in C++
>

The only real C++ standard is GNU C++. Microsoft would do well to
adopt most of its features.

Cheers,
R0b0t1

We’re back to religious wars about C++ again, regardless of what Mr. Kirby wants to admit. It’s not about NEEDING C++… we COULD all write our operating systems and drivers in assembly language like Cutler did back in the 1970s. But it’s cumbersome, its difficult, and only a select few can do it with excellence and clarity.

The same is true about writing code in C in the 21st Century.

Let’s start out with some established, unassailable, facts:

  • As an overall language, C++ is a massive, steaming, pile of shit. There were huge mistakes made when it was initially designed as “a better C” – The language as a whole is hideously complex and is famous for producing unreadable, unmaintainable, monstrosities.

  • “Within C++ is a smaller, simpler, safer language struggling to get out” as Bjarne what’s-his-name has famously said. This is described by the emerging CPP Core Guidelines.

(As an aside, I personally don’t give two shits about “performance” in a language so long as it’s “good enough”… I stopped caring about this, at least relative to my other two points above, some time around the turn of the century. No, I don’t want to debate this.)

For the hundredth time on this list I’ll point you to the CPP Core Guidelines document: http:

This is some really good work and if you haven’t read it, you should. Now. Go read it. Now. Do it.

I’m primarily interested in are two things:

1) Making kernel-mode programming “safer” – less prone to bugs and errors, such as buffer overruns, use after free, and bad pointer arithmetic.

2) Making kernel-mode programmer “easier” and “more clearly expressive of intent”

The Core Guidelines and the new features already in and coming to C++ make it a much better and safer language in which to program than C. They also make it a more EXPRESSIVE language in which to program.

Strong type checking is an undeniably good thing. std::span and std::unique_ptr are undeniably good things.

Contracts, coming in C++ 20, are undeniably a good thing.

enum classes, const, constexpr, are undeniably good things.

And I just don’t see how you can be against the std:: library – As it says in the Core Guidelines “Using only the bare language, every task is tedious (in any language). Using a suitable library any task can be reasonably simple.”

I don’t care if you love, hate, or even use an OO design pattern. What I care about are SAFETY and EXPRESSIVENESS.

We do NOT have to keep writing code like we were writing code in 1988, when they started work on Windows NT. We don’t write DRIVERS that way, right? We have WDF, right??

Sure… I’d love to see an entirely different language paradigm for driver development. Having actually WRITTEN multiple device drivers (and part of an I/O Subsystem) in C#, I would love to be able to use C# to write Windows drivers (as I’ve said before).

But that is NOT going to happen. We CAN use C++… or parts of it… because it’s inherently intertwined with our C-language heritage.

What I’m arguing for is a more directed, purposeful, adoption of C++ as a kernel development language for Windows to get us all to writing safer drivers more easily.

Peter
OSR
@OSRDrivers</http:>

Once MS comes with c++ WDK, with examples, we will surely follow.

Using C++ does not imply safety, not really. No one here is talking about ASM, and we should not DRAMATISE !

We talked earlier about EXCEPTION HANDLING in the kernel, some earlier said (s)he had a paper/pdf for kernel c++, and mentioned only exception safe code…

C++ has been around for 30 years, it’s about time to get to kernel!!!

Basically, the Platform owner has to push. How about C# ?? Or Java ?? Or Go ??

Well, this discussion is a BATE …

-Pro

On Jul 7, 2018, at 8:13 AM, xxxxx@osr.com wrote:
>
> We’re back to religious wars about C++ again, regardless of what Mr. Kirby wants to admit. It’s not about NEEDING C++… we COULD all write our operating systems and drivers in assembly language like Cutler did back in the 1970s. But it’s cumbersome, its difficult, and only a select few can do it with excellence and clarity.
>
> The same is true about writing code in C in the 21st Century.
>
> Let’s start out with some established, unassailable, facts:
>
> - As an overall language, C++ is a massive, steaming, pile of shit. There were huge mistakes made when it was initially designed as “a better C” – The language as a whole is hideously complex and is famous for producing unreadable, unmaintainable, monstrosities.
>
> - “Within C++ is a smaller, simpler, safer language struggling to get out” as Bjarne what’s-his-name has famously said. This is described by the emerging CPP Core Guidelines.
>
> (As an aside, I personally don’t give two shits about “performance” in a language so long as it’s “good enough”… I stopped caring about this, at least relative to my other two points above, some time around the turn of the century. No, I don’t want to debate this.)
>
> For the hundredth time on this list I’ll point you to the CPP Core Guidelines document: http:
>
> This is some really good work and if you haven’t read it, you should. Now. Go read it. Now. Do it.
>
> I’m primarily interested in are two things:
>
> 1) Making kernel-mode programming “safer” – less prone to bugs and errors, such as buffer overruns, use after free, and bad pointer arithmetic.
>
> 2) Making kernel-mode programmer “easier” and “more clearly expressive of intent”
>
> The Core Guidelines and the new features already in and coming to C++ make it a much better and safer language in which to program than C. They also make it a more EXPRESSIVE language in which to program.
>
> Strong type checking is an undeniably good thing. std::span and std::unique_ptr are undeniably good things.
>
> Contracts, coming in C++ 20, are undeniably a good thing.
>
> enum classes, const, constexpr, are undeniably good things.
>
> And I just don’t see how you can be against the std:: library – As it says in the Core Guidelines “Using only the bare language, every task is tedious (in any language). Using a suitable library any task can be reasonably simple.”
>
> I don’t care if you love, hate, or even use an OO design pattern. What I care about are SAFETY and EXPRESSIVENESS.
>
> We do NOT have to keep writing code like we were writing code in 1988, when they started work on Windows NT. We don’t write DRIVERS that way, right? We have WDF, right??
>
> Sure… I’d love to see an entirely different language paradigm for driver development. Having actually WRITTEN multiple device drivers (and part of an I/O Subsystem) in C#, I would love to be able to use C# to write Windows drivers (as I’ve said before).
>
> But that is NOT going to happen. We CAN use C++… or parts of it… because it’s inherently intertwined with our C-language heritage.
>
> What I’m arguing for is a more directed, purposeful, adoption of C++ as a kernel development language for Windows to get us all to writing safer drivers more easily.
>
> Peter
> OSR
> @OSRDrivers
>
>
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list online at: http:
>
> MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers!
> Details at http:
>
> To unsubscribe, visit the List Server section of OSR Online at http:</http:></http:></http:></http:>

Ah! I meant to add: Mr Craig… Worthy proposals. Thoughtful. Useful. Intelligent. Not *exactly* what I?m looking for… but what is?

Bravo.

Peter
OSR
@OSRDrivers

> using c++ does not imply safety

Of course not. But mod r. C++ *enables* and even facilitates it in ways that C can and does not.

Peter
OSR
@OSRDrivers

Totally :-).

You know, the efforts are sporadic, when it comes to language(s) to tame the beast…

Java, came out of pointer and memory problems. C# followed suite with die hard Windows fan complains about being FAT and slow, I don’t even have enough knowledge ( mainly due to lack of exposure and/or time). Then came Go ( Google wants it, since they are feuds with C++ ), who knows FaceBook will come with perhaps F or FB…

I know, and trust, that you used Apple I/O kit, and C++ there — They also have cutdown C++ ( do not do this, do not do that, and am not sure if they updated to c11++, not 17 or 20, since they are moving objective objective-c, ms from mm ext., then swift with GCD ). But when you work around and in core of xnu, it is all ( you may call shitty ) C. Only some hardware level drivers from Apple is written in C++ …

IMO, static ( compile time ) facilities are good in C++. Dynamic ( Run time facilities ) what worries me.

-Pro

On Jul 7, 2018, at 9:20 AM, xxxxx@osr.com wrote:
>
>> using c++ does not imply safety
>
> Of course not. But mod r. C++ enables and even facilitates it in ways that C can and does not.
>
> Peter
> OSR
> @OSRDrivers
>
>
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list online at: http:
>
> MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers!
> Details at http:
>
> To unsubscribe, visit the List Server section of OSR Online at http:</http:></http:></http:>

OMG…

I just don’t believe my own eyes. Am I hallucinating or what???

In other words, it looks like the list of “good coding guidelines”, as well as " recommended practices", is about to get extended well beyond using KMDF and inverted calls, pretty shortly. In fact, I would not get too much surprised if certain posters who were not so long ago were speaking the following way

start claiming, once in a sudden, that “using C++ is the only blessed way to do things”

Anton Bassov

> Basically, the Platform owner has to push. How about C# ?? Or Java ?? Or Go ??



I would rather suggest Haskel - test your code once, and if it works, it is going to work in 100% of cases, without any possibility of a random bug that reveals itself only once in a while. Sounds fantastic, don’t you think…

Anton Bassov