tags:

views:

1458

answers:

15

This is a subjective question.

I worked in Visual Basic 6.0 before coming into the .NET space.

One thing I see that there are a lot of things, for which there is a need to deal with the Win32 API. As a Visual Basic 6.0 developer, there were a lot of limitations. .NET fixes some of the old problems however the need to rely on Win32 has not been taken care of.

Will there be anytime that there wouldn't be the need to rely on Win32? (I guess only when .NET has support at OS level.)

I understand that domain of .NET (writing LOB applications/websites) and C/C++ is different so far.

Can .NET or any other infrastructure really make C/C++ less significant? Am I expecting too much?

EDIT: Doesn't it look like, building wrapper over another wrapper (and bring in new set of complexities along-with it)?

+10  A: 

Not any time soon. They aren't going to re-write the kernel and the core APIs in .NET in the near future, if ever. People have been expecting C to go away for a very long time, I just don't see it happening.

BobbyShaftoe
Actually... Microsoft's Singularity is an attempt to write an OS in .NET, up to an including the API: http://research.microsoft.com/os/Singularity/
R. Bemrose
Oh, yeah I've been following Singularity for a few years now since I first saw it discussed on Channel9. But if you read and watch what is discussed about Singularity ... they are not going to be replacing Windows with it any time soon, which is my point.
BobbyShaftoe
Singularity's core is written in C/C++.
Edouard A.
No, a few key low level hooks are written in C, and those do as little work as possible and then drop into managed code.
Jeff Hubbard
Singularity has gone hush-hush. There seems to be evidence to suggest that Singularity was a pure research project, and now they've taken engineers off of Singularity and the CLR team to work on Midori, which appears to be Singularity built for commercial purposes, possibly to replace windows in the next decade or two.We'll see!
Judah Himango
+17  A: 

It can't go away any time soon, but in Windows, at least, new projects are going less and less with C/C++. You can even see examples of Microsoft starting to eat their own dog food.

A great example of this is the C# compiler. Currently, it is written in C/C++. The C# team is currently working on re-writing it purely in managed code. A big reason for this has to do with CAS policies in .NET. Invoking unmanaged code requires FullTrust, so compiling code also requires FullTrust. As they move over to managed code, this limitation goes away.

As more and more developers go to .NET as their development platform, we are seeing Microsoft follow suit.

Another great example is Visual Studio 2010. They are re-writing large portions of the IDE using WPF and MEF so that it is easily extensible.

Next, look at the Silverlight runtime. It doesn't rely (specifically) on Win32 at all. It runs on a Mac just as well as it runs on Windows. As Silverlight becomes more capable, we may find many of the .NET calls that currently rely on Win32 no longer do so.

I guess my point is that we ARE starting to see some changes in the Windows world at least.

Of course, as soon as you need to be more cross-platform, C/C++ becomes more appealing again...

Brian Genisio
+6  A: 

There are a few situations in which C#/.NET will never be able to replace C/C++:

  1. The target computer has no .NET runtime environment, and you can't/don't want to force the install. (This would also be a problem with Java or Parrot/Perl6 ). This can also be a problem if the target has an older version of the .NET environment than your program.

  2. The code needs to run on Windows and Linux or OSX. C/C++ are more portable than C#, even despite Mono.

Colin
expand on number 1. The target computer has the wrong .NET. Pocket PC is a classic for this. The app targets 3.0 but the unit has 1 and it's 3 years old so the vendor isn't going to write the RE for it.
baash05
Number 2 is a very key point - all the world is not running Microsoft.
Jonathan Leffler
Number 2 is, indeed key. C/C++ are probably the most portable languages on the planet.
Brian Genisio
baash05: You can manually install .net3.0 on a pocketpc though. But the point still stands, sometimes you don't have the option of installing (the right version of) the .net framework on the target platform.
jalf
C compilers exist for more platforms, but I would not say that that implies that programs themselves are more portable. If you are looking for portability then Java is a better bet. Remember: compiler != platform.
i've heard that mono has 100% c# 3 support. but still #2 is the key point imho. c/c++ are more portable i think.
Johannes Schaub - litb
+5  A: 

Well, first of all, MS is working on an OS based on managed code (.NET) (Singularity). Now, this is just a research project, so there's no guarantee that anything will come of it, but it does show where MS is thinking.

Next, we have to consider, are we taking about the Windows world, or computer applications in general. C# isn't making big inroads into the Linux/Unix world, so C/C++ will remain strong there.

If we limit ourselves to just Windows, then I think, for new desktop applications, .NET has probably already passed C/C++ (C++ still has the edge overall due to the existing code base). However, for Web development, C/C++ was never very big to start with, so .NET passed them a long time ago.

James Curran
Check out Midori. Word is that Singularity the research project has morphed into Midori the commercial managed OS project.
Judah Himango
+4  A: 

As you said, C/C++ and C# cover different areas of development. The reason C# is replacing some C++ applications is mostly that C++ should have never been used in the first place for them (business data centric applications). All web browsers are written with C++, same goes for office systems, games, image processing, etc.

Nemanja Trifunovic
+1  A: 

C# has lots of good features. However, the biggest difference I know of between C# and C/C++ is that somebody decided the preprocessor was no longer needed.

For simple uses of the preprocessor, no doubt they were right.

However, many highly skilled/experienced programmers make use of code generation to significantly reduce programming effort, and improve software performance. For some problems, a preprocessor is a highly effective code generator. Leaving it out means those programmers have to find other, less convenient, ways to do code generation.

Mike Dunlavey
There a *lot* more differences between C# and C/C++ than a preprocessor. The biggest difference is clearly memory management. Although, C# does have a limited amount of preprocessor directives, though it does not have a true preprocessor or a macro language.
BobbyShaftoe
You're right, but I guess my emphasis has changed. Now I try to use as little data structure as possible, and the management of it is like hygiene, necessary but not what I want to think too much about.
Mike Dunlavey
... what I'm trying to say is the more data structure you have, the more you have to care about it's management. Programmers I know think in terms of designing data structure and filling it in with methods. I don't really work that way now.
Mike Dunlavey
link to C# preprocessor directives: http://msdn.microsoft.com/en-us/library/ed8yd1ha.aspx
Frank Schwieterman
@Frank: Thanks. As is noted there, "Unlike C and C++ directives, you cannot use these directives to create macros. "
Mike Dunlavey
+2  A: 
Manoj Doubts
+2  A: 

.NET runs mostly on Windows (with Mono on Linux and I think Mac). But C/C++ are still used in other places like embedded devices. Many compilers for other languages are themselves implemented in C/C++.

Slapout
Mono is on iPhone, Meebo (just yesterday), Android coming, more... .NET Micro while not popular (I think) is certainly getting into other embedded spaces.
kenny
+3  A: 

Seeing that almost all higher level languages are themselves written in C, I don't see this happening any time soon.

Nick
+4  A: 

This is similar to what a professor of mine said in the early 1980s - Pascal should be used for everything. I don't think so. Different languages have different purposes. The problem is that people tend to only see things in their domain. I work in modeling and simulation and sometimes work close to the metal. C++ is the language for me. I want it unmanaged and without GC. I don't work in the business/database world, so all the C#/Java/Beans/J2EE TLAs don't bring anything to the table for me.

Dan Hewett
Exactly! Many people assume that the only things people are programming are ERP or CRM applications, which I think is pretty ironic.
BobbyShaftoe
I can say about professors, having been one, they seldom have to take responsibility for putting garbage into your head.
Mike Dunlavey
+8  A: 

.NET has taken over C/C++ in the domain for which it was designed. Not many people are writing device drivers or other system level things in .NET. But it excels at business applications, which constitute probably the majority of the programming that is done.

Even C/C++ hasn't eliminated the need for people to write assembly in certain cases, so it's unlikely that .NET will ever eliminate it. But it was not meant to.

recursive
+1  A: 

I don't think that is going to happen either. This might happen on the windows platform (or not) but on the linux/unix platform I don't see that happening.

kal
+2  A: 

Considering that the newer languages are themselves written using C / C++ , it would be a long time before C / C++ is phased out (if ever)

Learning
+2  A: 

C# (or, more exactly, .NET Framework) wasn't meant to take over C/C++. What it WAS meant to take over is Java. But Java is truly multiplatform. Not "all right, all right, in our infinite mercy we'll allow Mono to exist, for now, but don't get too uppity" multiplatform like .NET.

JCCyC
A: 

If you mean "take over" in the sense of replace for all tasks, no.

If you mean "take over" in the sense of become more popular, it may have already happened.

To me, C/C++ is old in the same way that assembly language is old. I haven't written any C on the PC for maybe 6 years. The only time I write C now is for limited machines such as the iPhone. To me, the interpreted languages already seem to have passed up the compiled languages (at least in jobs available). But C won't go away in the same way that assembly won't go away. Just fewer people writing it.

Nosredna