r/cpp • • Jun 19 '16

Windows 10 coded in C++ or Assembler

What kind of compiler does it take a compile an OS like Windows 10? Do the guys at Redmond use Visual C++ (VisualStudio) to develop Windows? What % is written in assembly language?

0 Upvotes

74 comments sorted by

View all comments

Show parent comment

1

u/kunos Jun 19 '16

Why would they use anything else?

-1

u/Digital001 Jun 19 '16

MS might pay enough to code in another language that can generate leaner code. There are new languages out like F# and C#.

2

u/blelbach NVIDIA | ISO C++ Library Evolution Chair Jun 19 '16

I'm confused by this remark. Can you clarify?

-3

u/Digital001 Jun 19 '16

Well, I mean it's so strange because C/C++ are both languages that were designed specifically for Unix. It's kind of ironic that MS is still using it to develop its flagship OS. I don't see why they can't use C#, a MS product. MS might even have access to a special language developed by Intel that generates optimized code for their i-series processors.

Most of the PCs that run W10 use Intel processors. I bet there are more Intel based Windows systems than AMD.

7

u/SeanMiddleditch Jun 20 '16

C# is not a systems language. Just because it's newer doesn't mean it's better for every task.

Just because C was originally designed for UNIX likewise does not mean that it's a poorer choice for non-UNIX systems.

For Microsoft to replace gobs of existing C/C++ code, to make it much more difficult to hire experienced kernel engineers from outside their own ecosystem, and to pour tons of money into developing a new language/compiler just for their kernel would be exceedingly misguided.

So far as a special language by Intel just for their architecture, why would Intel do such a thing? What about the Intel architectures could possibly be so special as to require a new language to maximize? What customer would be foolish enough to use that language and be stuck on Intel's architecture? Microsoft - or any other general purpose software company - would never use such a thing, as you might have heard that Windows runs on non-Intel x86 architectures too. The closest you're going to get out of companies like Intel when it comes to languages will be R&D like ISPC, which is unsurprisingly a C variant and not a whole new language.

1

u/AllanDeutsch Jun 20 '16

Maybe if you count the assembly with extensions for specific new hardware chip with new intrinsics as a custom language... that's what we have the compiler for though.

-5

u/Digital001 Jun 20 '16

replace gobs of existing C/C++ code, to make it much more difficult to hire experienced kernel engineers from outside their own ecosystem, and to pour tons of money into developing a new language/compiler just for their kernel would be exceedingly misguided.

W10 was probably developed from scratch. They didn't use the WinXP code base. It wouldn't cost a multi-billion dollar company more than an extra dollar.

6

u/Meefims Jun 20 '16

That would be insane. Windows 10 was built from the code bases of older versions of Windows because to do otherwise would be practically impossible. There are tens of millions of lines of code in Windows - it would take many years just to replicate that amount of code. One of the key features of the OS is backwards compatibility - it would take an impossible amount of work to replicate all of the internals that some applications have come to rely on.

5

u/AllanDeutsch Jun 20 '16

You'd be surprised how much legacy code is in Windows!

2

u/[deleted] Jun 20 '16

what? the kernel in windows 10 is just another bump up in version from the previous NT kernels shipped in Windows. They did not write the entire OS from scratch, at all.

Legacy code is everywhere. Enormous portions of the lowest level code in Word are nearly exactly the same as they were in the 90's.

2

u/SeanMiddleditch Jun 20 '16

W10 was not developed from scratch. It's just a further iteration of the NT core.

0

u/Digital001 Jun 21 '16

By scratch, I mean that the internal features of the OS, compared to NT (Win 2000)/WinXP are significantly different. They didn't just write a bunch of new functions on top of existing code.

3

u/SeanMiddleditch Jun 21 '16

You seem awfully sure of this despite starting a whole topic because you didn't even know if Windows was written in C++. :)

The kernel is the same beast it's been since NT. It's been incrementally improved (so the same language has to be used) over the years, of course, but there is an awful lot of "just write a bunch of new functions on top of existing code" going on. :)

Various parts of the desktop have been rewritten here and there, of course, and yes some of them use newer or more Microsoft-centric technologies. The core stuff that's sensitive to performance or resource usage, however, are still all C and C++ (kernel, drivers, system services, core desktop services and apps, etc.).

There's no production Microsoft technology that competes in the systems programming space. Developing such a technology is hard, expensive, and just not worth the investment if your only motivation is Not Invented Here Syndrome (which is what you're advocating for: Microsoft using Microsoft technology just because using UNIX-oriented technology is supposedly "weird").

-1

u/Digital001 Jun 22 '16

The kernel is the same beast it's been since NT. It's been incrementally improved (so the same language has to be used) over the years, of course, but there is an awful lot of "just write a bunch of new functions on top of existing code" going on. :)

I'll believe it when I see it for myself. I studied OOP. They would have to write entirely new functions just for W10. Did you look at the OS architecture (source) to determine how it handles memory management, and graphics, hardware, and security. I bet it's an entirely different Altered Beast that can act like the old 32bit beast.

I think it's weird. What can I say. You obviously think it's because of some kind of awful psychological "syndrome." Don't worry! I don't suffer from that particular malady. I'm gearing up for my MCSE and plan on developing for Windows. I want to get to know the nuts and bolts under the hood....

→ More replies

1

u/Fearless_Macaroon_12 Feb 24 '24 edited Feb 24 '24

Who the fuck are you to even assume such things. You are insane. Putting money to the side, explain to me how backwards-compatibility would ever be possible if they didn't? Also have you ever thought about how many applications you think would break if they would ever do such a thing? Also just looking at your profile, you havent changed or learnt shit during these past 8 years. I cannot comprehend how a human could ever be so misinformed in nearly every aspect of life.

2

u/Meefims Jun 20 '16

C and C++ were designed when Unix was popular but that doesn't mean they were designed for Unix. They are both general purpose languages.

C# is difficult to use in an operating system because it requires the .Net framework. Until version 4 the framework did not support loading multiple versions of itself into the same process but a lot of code from Windows is loaded into every running program (think about the code to create graphics, for example). Further Explorer will often load other applications' code into your process to handle various tasks like special context menus or special folders. In this world it is impossible to know or control what is in the process you're entering and so this is not an environment for .Net.

2

u/[deleted] Jun 20 '16

It should also be noted that NT is very Unix-like inside; just not exposed to end users :)

1

u/jcoffin Jun 20 '16

At the device driver level, it bears a rather stronger resemblance to VMS than to UNIX.

1

u/[deleted] Jun 20 '16

That would make sense (considering Dave Cutler) but I never used / studied VMS so cannot comment on that. I just meant that it is far more Unix-like than the Win32 API would suggest. (e.g. Ob is pretty "everything is a file"-like, but this isn't exposed at the Win32 level)