The problem is the interface with the external world. If we’re talking about
generating code for the CPU, it works the way it works, and although I’d
love to see every optimization documented, I’m not that worried that they
are, as long as they don’t come back to bite me. However, I want to have the
option of choosing my own optimization level - the pattern of use where all
I am entitled to do is to type “build -c” is not very palatable.
As far as extensions go, a computer language is what a computer language is.
What exception handling does the standard require ? If the compiler’s
standard, it’d better supply that standard to me, user or kernel mode, and
I’d like to be able to take for granted that it works. The same goes with
STL or anything else that makes its way into the language standard, I expect
the compiler provider to give me a standard compiler with a standard level
of support for kernel mode software: I see no reason except money that I
shouldn’t be able to get a fully working kernel-side standard set of C and
C++ libraries with every compiler release. The best thing to do with
language extensions is, don’t use them - they’re messy enough, stick to the
standard ! Or, even better, get them into the standard so that everybody
supports them. If extensions to the runtime semantics are desired, they
should be implemented as libraries with a very clear and sharp API, leave
them out of the compiler.
Now, about sizes of data types. They should only matter at the lowest level,
when the driver talks to the iron. The upper edges should be such that I can
take it for granted that if an API says “unsigned long” on the OS side, I
then get a compatible representation when I write “unsigned long” in my
driver ! And I find it verging the unacceptable that any interface from the
OS down to the upper edge specifies any data type that’s not either a
standard C type or a class or structure based on standard C types. So, don’t
say WORD or DWORD, say short or int, and assume that the OS and the compiler
generate compatible types -and DOCUMENT those types, please. And here,
again, the lowest level is well served by run-time support, be it in the
form of library routines or pseudo-calls that are expanded into machine
language by the compiler.
I don’t know, I detest compile-time gimmicks. Compilers should concentrate
on generating code that works.
Alberto.
-----Original Message-----
From: Don Burn [mailto:xxxxx@acm.org]
Sent: Friday, May 23, 2003 4:09 PM
To: NT Developers Interest List
Subject: [ntdev] RE: XP DDK Compiling
You and Alberto are smoking something or highly naive, see comments inline:
From: “Nick Ryan”
I agree. The various undocumented compiler and linker switches needed to
build a driver with the Microsoft compiler trouble me. I’m the kind of
engineer who wants to know EXACTLY what inputs there are to my
development environment, and EXACTLY how they affect my product. The
best thing Microsoft can do right now for the productivity of its
developers is to take four people from the DDK and VisualC teams and
give them the following tasks:
- Fold the separate (and prehistoric even by UNIX standards) DDK
development environment into Visual C .NET. Drivers are no longer 10 C
files and a header. They include multiple external libraries and shared
code between user-mode and kernel-mode projects. This sort of thing is
impossible to do within the limitations of the DDK. It forces us to
manually migrate compiler and linker settings into native Visual C
projects, which requires an expert hand to say the least.
The Visual Studio team is targeting 100,000+ developers and users, the
DDK team is supporting ~5000. where is the business sense in this!
Even if there was a business sense, you either have to lock down the
options (see more in my comments on Alberto’s post below), but that
is not what someone using Visual Studio expects.
- Clarify what versions of the OS a given driver built using given
options will work on. No, it is NOT an option for us to build separate
binaries for 2k, XP, WNET, etc., when one is possible. I can build a
Win32 app that runs on anything from NT4 SP3 to 3790. Right now I’m
building a driver binary that works perfectly on everything from W2K SP0
to 3790. This makes QA much happier and vastly reduces the size of our
installer.
I concur with the basic concept, and I believe the DDK team is trying to let
people know how to do this with the Win2k3 DDK.
- Either remove the undocumented options from the Visual C compiler and
linker or document them. We are responsible to our managers for the
content of the binaries we product. How can we do our job properly if we
don’t know what goes into these binaries?
Except for GNU (and there you have to study the sources, not documentation)
I’ve never heard of a compiler without some level of undocumented support.
Gee, as a former compiler writer am I supposed to tell you all my
optimization rules and code generation patterns, I don’t think so.
From: Moreira, Alberto
>
> The issue is not which compiler to use. The issue is the
> looseness of the API. As I see it, every driver should be
> compiled with the ANSI-strict switch on. Needing a specific
> compiler to build a program - ANY compiler and ANY program -
> is a sign of weakness of the ennvironment.
>
Wow, lets see what this means, well no exception handling since the calling
conventions
are not part of the ANSI standard, for that matter calling convention isn’t
either. Of course that won’t matter since ANSI compilers don’t define the
size of any base types (such as char, short, or int). Well, maybe Alberto
mean’t an ABI (application binary interface) this is
what vendors define for calling conventions, of course most ABI’s still
don’t specify exception handling, since there is a lot of compiler smarts in
that.
This would also make debugging interesting, there is a ton of data you have
to define to support debugging especially if you try to support debugging
with any optimization. Of
course with the large customer base of 5000 people it makes perfect sense
for every
compiler vendor to build a kernel debugger for their compiler.
I have been the project lead on compilers for OS development, and an
architect for multiple OS’es, this stuff is hard and you do go out of your
way to make it harder by giving up control of the development environemt for
pieces that plug into your OS.
Don Burn
Windows 2k/XP/2k3 Filesystem and Driver Consulting
You are currently subscribed to ntdev as: xxxxx@compuware.com
To unsubscribe send a blank email to xxxxx@lists.osr.com
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.