Re: Does Bill Gates know about the DDK regarding C++?



Don Burn wrote:
First is you have not read http://www.microsoft.com/whdc/driver/kernel/KMcode.mspx read it. Second, as I said in an earlier post, there are people who carefully craft drivers in C++ for the kernel. One of the careful things is never use STL, even the most rabid C++ types I know would never use this in a kernel driver.

I don't use C++ for a lot of reasons:

1. Kernel driver programming is hard. Bottom line you have a lot things to get right, so why add another problem to a already complex task.

2. C is the standard. I try to think of my customer whether I consult or an an employee. One of the things you have to consider is the next person who gets your driver. Are they going to know C++ as well as you do (and if you don't know it well you shouldn't use it), are they going to be able to easily understand you classes. One thing going for driver development is that drivers enforce a lot of structure on your code, hiding things in C++ can obscure that structure.

3. C++ can do a lot of things behind your back. See the paper for some examples, but bottom line is C++ can grab stack, create initializers in unexpected places and in general surprise you. Note: that some Microsoft teams that use C++ in the kernel, do assembler code reviews to be sure things are right.

I like C++ for a lot of things. I have used the language for over 20 years. I have supported compilers for the language and written code generators for the language. Finally, I was on the C++ standards committee for a while.

But while I like C++, I take the minimal C++ approach that many Bell Lab's people did in the early days of the language. I.E. use it for clean simple encapsulations and small classes. Even with this approach, I would never use the language in the kernel.


Oh good grief here we go again.

Folks this has all been discussed and hashed out endlessly. There are limits on what you can do with C++ in the kernel. On the other hand there are good reasons for using object oriented languages.

Don forgot to mention that WDF is written entirely in C++, except of course for the exposed C api for us mere mortals. I rest my case.


--

=====================
Mark Roddy DDK MVP
Windows 2003/XP/2000 Consulting
Hollis Technology Solutions 603-321-1032
www.hollistech.com
.



Relevant Pages

  • Re: 2.6.30-rc4 kernel
    ... I think there may be a problem with the 2.6.30 kernel that is ... # Generic Driver Options ... # PCI IDE chipsets support ... # Other IDE chipsets support ...
    (Linux-Kernel)
  • 2.6.30-rc4 kernel
    ... kernel panic - not syncing: ... # Generic Driver Options ... # PCI IDE chipsets support ... # Other IDE chipsets support ...
    (Linux-Kernel)
  • [PATCH 18-rc2] Fix typos in /Documentation : N-P
    ... Again, if you're not gonna do synchronization with disk drives (dang, ... -the kernel. ... There are two options specific to PSX driver portion. ... The driver uses the settings from the EEPROM set in the SCSI BIOS ...
    (Linux-Kernel)
  • two scary syslog kernel messages
    ... Sep 20 03:46:06 marvin kernel: kernel BUG at mm/rmap.c:482! ... ACPI: Local APIC address 0xfee00000 ... Allocating PCI resources starting at 80000000 ... ** driver failed to call pci_enable_device. ...
    (Debian-User)
  • Re: [PATCH, RFT, v4] sata_mv: convert to new EH
    ... check both new and old drives with SMART ... Use a HIGHMEM enabled kernel. ... ACPI: PM-Timer IO Port: 0xe408 ... Real Time Clock Driver v1.12ac ...
    (Linux-Kernel)

Loading