Re: Why no C++ in Windows itself?

From: Tom Widmer (tom_usenet_at_hotmail.com)
Date: 02/10/05


Date: Thu, 10 Feb 2005 18:07:35 +0000

Severian wrote:
> On Wed, 9 Feb 2005 14:07:44 +0330, "Herr Lucifer"
> <"\n"HerrLucifer\n@microsoft.com> wrote:
>
>
>>It is a long time now that I am using "Dependency Walker for Win32" and
>>navigating through different Dlls in "System32" folder to find my target API
>>functions. The thing I have noticed is that, 'almost' all system .dll and
>>.exe
>>files are written in C and not C++. If C++ is a powerful OO language and
>>it's much greater than C for large application development, then why haven't
>>Microsoft used it in its operating system? Is there a compatibility issue
>>here that I am not aware of? Or something else?
>>---
>
>
> IMHO:
>
> For time-critical issues,

Do you mean that C is faster executing? Or that its performance is more
consistent (for a realtime system)? I don't think either statement is
particularly true, though some C and C++ features should be avoided in
code that should run in a bounded amount of time (e.g. no dynamic
allocation, no disk IO, etc.).

  smaller code size, better memory
> consumption,

C does generally produce slightly smaller code, due to the overhead EH
and RTTI in C++. However, both of those may be avoided if desired.

  improved control over efficiency,

How so?

  improved code
> generation,

The code generation is generally worse in C, since I believe that type
based alias analysis isn't as good in C. Is there any other respect in
which you think C can generate better code?

simpler interface to assembler,

What do you mean?

  and easier debugging
> (especially the kernel and low-level code)

But macros are far harder to debug than inline functions!

  the guts of Windows are
> mostly written in C.

That I know nothing about, but it certainly sounds true. But I believe
much of the Linux kernel is now written in C++ (as was BeOS). C++ is
primarily a systems programming language - it was specifically designed
for writing OSes (among other things), hence the priniciple of "You
don't pay for what you don't use."

I'd definitely prefer to write an OS in C++ rather than C, and the
resulting OS would probably be faster and better for it (though possibly
not smaller).

Tom



Relevant Pages

  • Re: Why no C++ in Windows itself?
    ... Is there a compatibility issue ... Do you mean that C is faster executing? ... The code generation is generally worse in C, ... much of the Linux kernel is now written in C++. ...
    (microsoft.public.dotnet.general)
  • Re: Why no C++ in Windows itself?
    ... Is there a compatibility issue ... Do you mean that C is faster executing? ... The code generation is generally worse in C, ... much of the Linux kernel is now written in C++. ...
    (microsoft.public.vc.language)

Loading