Annotated C Reference Manual Stroustrup Pdf Merge

I realize for most of you this is probably old news. I have been taking a first look at C# a little while ago, because I wanted to know if it is worth looking into, and because I am thinking about polishing up my class on Parallel Programming here at the university with a little language diversification. I have taught it using POSIX Threads before, but since everyone and their grandmother seems to use Java or C# these days, throwing in a couple of examples in these languages won’t hurt. And besides, I was curious;). Without having written a single line of code and just by reading the various guides available, I have come up with a list of differences between C# and C++ and thought you might enjoy reading it here. And so, without any further ado and very brief, here is my list of differences between the two, sorted into three categories: things I like better in C#, things I like better in C++ and things where I could not make up my mind.
The last subheading lists the resources on the net used to compile that list: Pro C#: • garbage collection • array bounds checking • huge.NET-Framework library • types have a defined size (e.g. – “abstract classes can contain code – interfaces in C# cannot” err C# has abstract classes, too. Interfaces are just. And, for good OO-programming’s sake, they should NEVER contain code. So, I’d move this one to the “Pro C#” category, reformulated as: “C# has interfaces, C++ doesn’t” – “any type can be thrown as exception (only classes derived from System.Exception in C#)” Forgive me, but I can’t see the problem. Again, in an OO world any exception should inherit from a base class. If you need to add custom information to an exception, just make your own exception class.
Annotated C Reference Manual Stroustrup Pdf Merge. Beginner's Guide to Linkers. This article is intended to help C & C++ programmers understand the. If everything in the sample C file listing. The contents of an object file are. C filedata, corresponding to definitions. C file (for an initialized global. All of these instructions.

– “C++ offers pointers”.Which, again, should NEVER exist in any modern language. I agree that for low-level tricks pointers may be useful, but otherwise stick with references.
I could go on, but I don’t want to be pedantic (MACROS? No, seriously 🙂 ) My point is that C# has its shortcomings, but you shouldn’t overlook the major semantic cleanup which it represents compared to C++. And it has Events! 😉 Ciao, Alessandro •. I’d suggest “Inside C#” (Tom Archer, Andrew Whitechapel) and “Introducing Microsoft.NET” (David S.
Both include chapters on multithreading. As far as multithreading is concerned, I think Pro C# is the ThreadPool class and lock statement, which in most cases simplify development of multithreaded code.
Some categorizations, as you say, may be controversial. “Huge.NET library” is a big plus when you develop a server side solution, where you control the environment. When you develop a cliend side solution, this may end up as “huge additional download and install” for users, so may be placed in “Pro C++” category. 🙂 Also, you can not develop system stuff and device drivers in.NET. If I extend Alessandro: C# has its shortcomings, but if you can live with them, it sure makes your life much easier than C++.
A C++/CLI may be a good merge of both worlds. Hm, almost half of your “positives” on the C++ list are actually the negatives that promoted the development of C#. As a veteran C++ developer I can see where you are coming from, but you shouldn’t post views on something you haven’t grasped. Let’s go through some of your misconceptions: – Better performance: What do you base this upon? C# and C++ are both just high-level programming languages. Performance is dependant on how the compilers interpret andr translate your code and nothing else.
– Multiple inheritance && pointers: These are two of the most important differences in my opinion. MI was nothing but a root of so many problems in a multi-developer environment. The same I can say about explicit pointers.
By developing the interface and delegate-features in C# these problems have decreased a lot. Bottom-line in the MI-issue is – if you can’t design a model using only interface-implementation and single-inheritance then you simply aren’t fit to design it. – Support for macros: I tend to agree a bit, but you should look into attributes of.Net to see that there is a whole lot you actually can do to interact with the compiler. Of course this applies to C++.net as well, but now I guess we are leaving the.Net part out of the discussion.
– It is interesting to see that you give a plus to both C# garbage collection as well as the old deterministic destruction of objects. I would like to see why this ambivalence exists. If you use C++ eg. For game-programming, sure – then a lot of your points are true, especially on the det.destruction-point. But since you are comparing C++ to C# we are not talking about these kind of applications and therefore there is nothing that promotes your old memory-leaking problems that even the most experienced developer creates in old C++ vs. Managed garbage collection.
– Support for globals: What kind of “global” are you missing in C#? If you haven’t grasped the namespace-system then you should study some more. In a true object-oriented model there is need for only one global – the root class. If you don’t know how to develop without using “free” globals, then you should study even further 😉 – Supports bitfields: True enough that the language itself doesn’t support this, but again we are not discussing applications where pure mapping to machine-code is essential (if we were discussing that we wouldn’t even talk about C#). However, since C# is mainly used in the.Net environment, this is not a problem since.Net offers the same bit-array-handling you have natively in C++ and a lot more manipulation-possibilities that are not there in C++. Thus, no negative. – STL: You have got to be kidding me or you really have no idea of the extensiveness of the.Net-library.
Nuff said on that! Jeez – Portability: This remains the argument in the Java-world, but the the fact is this is not (and has not been for a long time) an issue in corporate reality. The only major shift between platforms done on a global scale the last two decades have been from old Cobol-systems to either (or both) Unix/Linux and Windows. What an intelligent and cost-effective enterprise today does is to utilize the power of a platform and thus using the environment best suited for this purpose. Neither Java nor C++ classic can do this, just because of the platform-independentness that many of there libraries are built upon. Therefor they are actually far weaker choices as environments. – any type can be thrown as exception (only classes derived from System. Oddworld The Oddboxx Pc Games. Exception in C#): Not sure what your getting at here so please expand that.
You can catch all exceptions in try-blocks, even from unmanaged components, so what is your point? – ability to enforce const-correctness: Dear old discussion in the C++ community but i tend to agree with Anders Hejlsberg on this subject and do not see this as a major downer. Well, in conclusion – C++ is naturally the given choice in real-time or close to real-time application-development, but when comparing it to C# we are mainly in the.net-world: In this environment there is in my mind no comparison and C# comes out the winner. Anjuna Moon: Thanks for sharing your thoughts here. You raise some very valid points. Unfortunately, you have chosen to spice up your points with personal attacks, which does not help your credibility at all, in my humble opinion. You have also misunderstood the point of the post: I have listed all the differences I could find.
Yes, that means some of them are contradictory. It is not a list of things I like or don’t like about these languages. As I have posted at the very beginning of the article, I don’t even know enough about.NET to judge that. This comparison and discussion is interesting for both the content and the opinions of the participants.
The thought that a language like C# can be as efficient as C++ is false. The statement C++ can be as efficient as C# is true. Features such as garbage collection are not free – I’m sorry to say. Its also interesting to see how some see a sortcoming (or just a decision not to support a feature) as a benefit. Now that’s some great spin. I’ve used multiple inheritence a bunch in the past and the noone ever complained. Sure, I can make all of my classes derive from the exception class so that I can throw them.
But to spin this as an advantage is comical. The question I would ask is this: if MSFT hadn’t depricated all of its C++ libraries in favor of C#, would there be as much of it out there today?
My answer would be no •. I don’t really know C# and I appreciate the list but I do know C++ and would like to make a few comments if you don’t mind.
* garbage collection C++ has 3rd party garbage collection, and in all flavors too. You can get a reference counting GC or use a Mark and Sweep one or whatever other algorithms are out there.
They work pretty well and override the global operator “new” function. Check out Stroustrup’s FAQs for pointers on this part. * array bounds checking Just pointing out that you can use std::vector.at() and you’ll get bounds checking.
I find it hard to think of situations when I’d use an array over a std::vector. * built-in support for threads A valid complaint, just noting that C++0x will hopefully rectify that situation 🙂 (Stroustrup says “C++0x will almost certainly include a threads library.” in his FAQ). * no fall-through on switch-statements * arithmetic operations can be checked for overflow if required These sound pretty awesome. I’ll have to look into C# just for these feature alone.
* objects must have a definite value before being used I’m somewhat confused by what you mean about this. If you don’t provide a default constructor in C++, you are forced to initialize every object, or else you get a compile time error. Perhaps you mean primitives must have definite values?
Hi, In my humble opinion, as I use both C# and C++; it’s all about what you are planning to do and how much confident are you in handling what you do. I don’t see much negatives in C++ as some lazy and careless coders see here. I find Multiple inheritance feature and pointers as awesome.
I have hardly had the problems that are mentioned above. A half breed programmer is always half breed despite the tool he use. A programming language is a mere tool that helps you create what you want. C++ is all about endless power at developers disposal. With power comes responsibility and so, the developer is responsible to make decisions and implement. I personally don’t like to be limited by the inadequacy of the programming language i use. It is my job to improve as years goes by and makes caution and clean design and goals part of my programming life.
The way I see, the only area where C++ does not fit in today’s world is where no one gives a damn about how good the developer or a particular block of code is, but all they want is some output close to what they require. Developers wants to feel they are good developers right out of college.
C++ takes time to learn, master and it feels great when you start using it. In fact, all this years of sound existence despite the arrivals of so called safe and powerful languages speaks a lot about the language itself. I am excited about C++0x and the features I’ve used so far are just awesome I am just waiting to hear C# and Java catching up with C++ on those features soon:) Man I just love that lambda expression feature in C++0x. No offense to Java/C# developers (since I do C# coding too as part of my profession). It’s the same negatives you believe are +ive for C++ and I see a very bright future for C++ than any other languages. Hi, To begin with; what I am going to say is strictly my own personal opinion, based on my past experience with both the technology, what i’ve read about them and what I have observed about the future goals.
In my humble opinion, it’s a total waste to bank on proprietary standards and proprietary programming languages. I am not against them, but the way i see it, the open technologies are leap frogging the closed technologies. I don’t see much of bright future for c# 10 years from now where the disconnected desktops does not play much significant role. If it still exists (c#, etc), it will be entirely incompatible with what you develop now and most importantly the windows operating systems you will be using 10 years from now will be entirely incompatible to the software you develop right now. For example, I had developed a small piece of utility software during my university days (8 years back) which I still use despite the evolutionary change in C++. All I had to do was to re-compile the source code with gcc4 under linux and am still using it. If it’s the other way around; I’ll have to either re-develop using the framework available right now (at least a major portion of the code).
Having said that, I am not implying that there won’t be wast changes 10 years from now. 10 years is too much ahead for us to think and so I can’t be 100% certain about anything, but i have enormous faith that C++ will sustain with big backward compatibility support.
Java might survive (I use might since i am skeptical about the growth of java base – the size of java gets complex and bigger) since it’s open sourced. Though mono exists, no one is certain about the future of mono and I am sure within 3 years from now, Microsoft will be at even with Linux and other *nix operating systems. So you’ll have to take your application platform independent. In those scenarios, languages such as Java, C++ (GCC, QT), Python, Perl, PHP makes much more sense than.NET. I leave the decision to yourself.
I haven’t used C# so far, perhaps because I’m a bit afraid that I adopt some programming styles there that let me make more errors in c++ later. But today I’ve seen a video about the Currency and Coordination Runtime (CCR) that M$ is using in their M$ Robotics Studio. That programming paradigm looked interesting, so guess I have to learn C# anyway. For me, one advantage of C++ was always that I can really have an idea, how the code looks after compiling and what happening in memory, when it’s executing, except some low level optimizations with opcodes, inlining and such perhaps. So although you write object-oriented stuff, use templates etc., the code that the compiler is generating and the processor is getting to eat is exactly what you wrote. ( If you use a debugger, you can usally nail each C++ command or addressing mode down to one or a few opcodes ) There is no hidden overhead or some mysterious stuff going on, once you understand C++ and the underlying hardware.
The main drawback is of course that it has a steep learning curve. You need a deep some knowledge of the possible pitfalls, before you use a language feature, and you need obey some programming guidelines, otherwise C++ becomes a bug hell.
Another thing that can be seen as a drawback is that you have to juggle with lots of libraries, which makes sense ofc from the C++ perspective, because C++ is a platform independent ISO standard. So all the stuff that’s platform specific isn’t meant to be part of the language. So in short, one big problem of C++ is that you have to think so much, what you are doing to avoid mistakes and that you can easily lose yourself in the details. And there is usually not one way to do something, there are several. Like I already said, one advantage is that once you understand the details of the language and can switch your brain to compiler perspective, you can more or less immediately see, why some code has undefined behaviour, crashes or is not efficient etc. One definite proof that programming C/C++ requires a lot of discipline have been the buffer overrun bugs and explots in the past.
I guess most of them had either the reason bad coding style or simply that the programmer was just not understanding enough about the inner workings of c++, how the code executes and where the pitfalls are. Using parts of the language that you don’t fully understand or an “it compiles, so it’s working!” – mentality is suicide in C++. Something everyone needs to think about is what you are programming. If i need to do a lot off different things i use C++ (I still don’t know everything so this could be why), but if i am gonna focus on a few things some reason c# works better like. Example using system files. Of course i don’t know c++ well. I can use little things, but that what the web is for!
For good books on C# Simple Program Design C# which is for beginners and Program Design C# it is by Robertson or something, it is really good with showing easier ways to do things and how to get around walls. I got it from one of my teachers. After that i started getting into C# i never really used C# or C++ before that. I’m not sure what your classes are and who they are for, but also if someone wants something to do or mess with batch files are easy to make and can help speed simple tasks up! (that something for the beginners.
Kinda a mix of basic and C.) •. C++ is for those that have a strong computer science background matched with years of experiance using the language. It is just a tool that gives a lot of power to the programmer and thus how dependable and usable it is depends mostly on the ability of the programmer.
C# and Java give less power to the programmer. However for a beginer or intermediate level programmer, the baby sitting features of these languages hold serious value. The end product will be more secure, less buggy, and easier to maintain. I think it comes down to your background and the time you are wiling to invest. Interesting discussion, although the title is a bit of a misnomer. What is really being discussed here is managed versus unmanaged code – not C# vs C++.
Both C# and C++ can create managed apps. C++ can also create unmanaged applications that are compiled directly to native code. Some other points for consideration: – As mentioned, the C# compiler does have an unsafe mode which allows pointers. – C++ is the only.net language that allows the creation of managed and unmanaged code in the same assembly (unsafe).
Other languages can call unmanaged code (such as a windows API) but cannot create it. The following offers a nice summary of mixed mode development: () – STL is available for managed code (managed C++ specifically) in the form of the STL/CLR libraries (Microsoft.VisualC.STLCLR.dll) in.net 3.5 distribution () – Managed code can usually accomplish the same functionality as an unmanaged app in about 35% of code that needs to be written by the developer due to the richness of the Framework – you are moving functionality from your code to the Framework. Less custom code means fewer opportunities for errors, and maintenance is easier. Managed code offers significant time savings in both coding and optimizing. Again, this is not a C# vs C++ statement, it is a managed vs unmanaged statement. – Although generally considered faster, being “native” is not a guarantee of performance.
Recently I have been learning both C++ and C#. I have been avoiding CLR C++ as I cant see a point to managed C++ other than a very slight compiler optimization performance gain over C#. But C# seems to be much more productive and easier to learn and I find myself spending less time programming things that are of no relevance to the application I am developing, where as in C++ I find much time spent handling things that provide no functionality to the application but rather enable functionality. As for the threading and paralell programming topic, the.net framework makes it very easy and safe, I have not tried threading in native C++ but judging by what I have learnt so far, it will be a much more trechorous and unproductive endevour than in.net Just my 2 cents •. Hi In my opinion, the important thing about programming is not the skills the programmer shows, but the usefulness and stability of the applications.
If the software is good, fits the clients, and is stable, it doesen’t matter what lies behind it, providing the programmer is able to mantain and further develop it properly. In this context, obviously C++ and C# live together in the deep and wide space of the programming sky, and are aimed at different kind of users, and different purposes. It’s useless to compare them side by side, because they are complementary, and so, the users benefit from the fact that there are two alternatives and not one, as before C# came into view.
Clearly, C++ and C# have advantages and disadvantages, as everything in life. The choice will depend on many factors, and of course, one of them is the skill of the programmer. But others are: readability of the code, maintainability of the code, portability, etc. Finally, I am surprised to find such a hard defense of C++. C++ is undoubtely great.
But many applications developed in it aren’t so great. In fact, many of them are awful, and that makes all of us suffer with erratic behaviour and random hangups while doing our everyday job. I am sure that if those applications had been developed using C# instead of C++, this would happen less.
So, if the programmers aren’t just skilled enough to use a language as powerful as C++, well, we have two options: Have them all sent to intensive courses, or have them learn a language which is more suitable to them. Second is far much better, don’t ya think? I am a c++ Programmer Concerning threading and multicore programming, I attempted to give a go at this a few months back, even looking at some oneline MIT lectures on algoritms.
The fact is that, at least for me, it is not too hard for me to write threading code. I use C++ Builder and it works for me.
But the main concern is identifying where your code will be a good candidate for multicore development. I can sort 1,000,000 numbers serially (one thread) or split the list in two sort 500,000 in two threads then merge and get a performance increase by 95% But you have to knoe the algorithms and you got to have to vision to know what part of your code can benefit from this. These skills has nothing to do with the language set.
Once you support threads, as far as I am concerned, you support multicore programming. I think fall-through in switch statements is actually an advantage in C++. In C++, switch fall-through to avoid duplication of code for multiple cases. To achieve the same thing in C#, you would have to create a function to be called in each case.
Also, you left off an important difference: C# supports only the object-oriented paradigm, forcing you to create a class for everything (stand-alone functions in C++ would become static methods in a class in C#), whereas C++ allows either object-oriented or procedural programming. People have different opinions on whether it’s better to force object-oriented programming or to support both styles. C++ Still wipes the floor with C#. I have tested many times (even with 2008). I think the best I got for C# was 2.4X slower. The worst case was about 10X. I even had one case where I wrote my own custom heap in C++ and I got 42X faster.
I won’t count that however. But it does point out a major advantage of C++. You can really customize things if want to go that far. I’ve seen a lot of C# vs C++ benchmarks posted by C# fanboys. I tend to consider them a lot of BS.
Mainly because just writing your average test such as a sort or something along those lines, C# never even comes close to C++. In a 200K line application you aren’t going to go over every routine with a toothcomb trying to optimize it. C# is a decent language but I’m simply not even going to consider writing performance sensitive code in it as it stands.
My numbers show it’s slower and real world experience with applications shows its slower. In my view managed C++ is the worst of both worlds. It’s not really C++ and in general just messes you up.
I would use C# before managed C++. Again I don’t consider C# a bad language, just kind of slow. I might use it for some things due to ease of programming. However in most cases I end up working on stuff like games where the performance matters so anything other than C++ goes out the window. I’m still waiting for a new latest greatest compiled language to become accepted without all the quarks of C++.
However at this stage of C++ is the only option for most of my work. I do like C++ for its speed, and much of my own experience has been with C++. I agree with you that Managed C++ isn’t a language I’d choose to use, but if you ever find yourself in a job requiring you to use C# and you need to use some legacy C++ code, you’d have to do some Managed C++ to bridge the gap. I am a bit disappointed that most new programming languages that come about these days tend to use a runtime (i.e. Java and C#) or are interpreted (Perl, Python, PHP, etc.). Speaking of new compiled languages, there is a newer compiled language that I’ve heard about but haven’t used yet, called D: •.
I used to think C# is much better. But god damn, C++ got huge design advantages. The generics are like class parameters, you can send any type of object (3, “abc” new Date()), while in C# you can only send a type (string, int, etc.) not to mention the multiple inheritance too bad C++ got such a ugly syntax. And a lot of other disadvantages XD. Actually i still think C# is much better. But why the hell did they give up the C++’s generics?? And BTW, you have mentioned a lot of C++ advantages which are actually dis advantages.
For example: any type can be thrown as exception (only classes derived from System.Exception in C#) this is much less organized like this. And this: allows default arguments on function parameters exist in C# 4 (don’t ask me what took them so long) •. I guess any feature could be considered an advantage or a disadvantage, depending on how you look at it. Being able to throw any type as an exception is flexible, and isn’t really a problem if you have a catch () block, which will catch anything. I guess the problem is that it can be hard to know what will be thrown in C++, so I think C#’s exceptions are nice in that you can always catch System.Exception as a default and still be able to look at some of the properties of the exception object. I’ve also heard some people say that C# is slow compared to C++, and some things that need the speed still need to be done in C++. For speed, I wish C# would at least compile down to native code rather than a runtime object (C# apps use the.NET runtime, similar to Java apps using the Java runtime).
Also, C#/.NET’s garbage collector adds an element of randomness to the application, which might sometimes be a bad thing. IMHO only C# advantage over C++ are it’s more extensive libraries. * garbage collection 3rd party or your own library. Actually it’s easy to code (however has uses only when coder is lazy, because one which isn’t lazy makes his own heap) * array bounds checking hmm.
* types have a defined size (e.g. A long is 64Bit) that is why there are macros for your code to see under which compiler you’re compiling. Make your own long * strings are encoded in UTF/16 wchar_t (windows UTF16, unix usually UTF32) * autoboxing – every type can be treated as if it inherits from object ehm.
C# Best Practice – Do not use boxing and unboxing. * supports constructor-chaining (one constructor can call another constructor from the same class) that is why I usually write init method * static constructors (run before the first instance of the class is created) static instance in class * exceptions have access to a stack trace easy to do if you can take being platform dependant * advanced runtime type information and reflection if you intend to do this (say with serializable objects etc.) you may as well write it. * supports variadic functions nicely well as boxing isn’t recommended * built-in support for threads once again, it’s just classes written for C#. I haven’t noticed any autolocking of variables used between different threads * no need for header files and #includes well, I guess this is plus * no fall-through on switch-statements as I actually use them sometimes, it means extra goto line * arithmetic operations can be checked for overflow if required well, once again this can be considered plus. However the expense of this is very close to doubling integer size and then checking upper half if overflow occured. So can as well be done C++ * objects must have a definite value before being used considering the way C# handles member variables initialization (e.g. If not specified zero), it’s IMHO worse than not initializing them at all.
Besides that some C++ compilers also give warnings about uninitialized variables. * attributes can be attached to classes and retrieved at runtime well, it isn’t bad at all. But as one can guess, you can make your own base class for all classes you write thus having same functionality. * access to class members / functions is done only by the dot (no more ->or::) well this is about the “no pointers” in C#, no pointers no deref. * conditional functions (e.g. For debugging) hmm? * structs and classes are actually different (structs are value types, have no default constructor in general cannot be derived from) well, I guess this comes from what C# is.
Struct is value while class is object. I don’t really see a + here. It’s just different. * supports properties behind the scene on += with properties C# compiler does get and then set.
I really see no positive in this. Otherwise it’s nice if you need some validation of input. But IMHO input should be validated on input instead per every set. * readonly members are const, but can be changed in the constructor never had need to have const member taking space in instance. * finally block for exceptions once again some C++ compilers have this extension (guess who’s), however can be as well emulated with try-catch which will compile anywhere * arrays are objects as are std::vector, std::deque etc.
* support for anonymous functions templates * supports the base keyword for calling the overridden base class once again some C++ compilers have __super. However this only works as hoped for with single inheritance and thus may instead bring bugs instead of reducing them.
(AFAIK that is why it was rejected by other than M$ compilers) It may seem I dislike C#. It isn’t truth, it actually saves you some typing time. I just like C++ a lot more. In the end it’s only about the libraries you have and use for which language. If you have them for C++ you don’t need C#. Mirek: I think you have some valid points, but I think some of the points in favor of C# are good, too. I’ve used C++ quite a bit in the 5 years I’ve been doing software professionally, and I like C++.
However, with some of the frustrations I’ve experienced with C++ and the time taken to do certain tasks, I can appreciate some of the features of C#. As a more recent language, the C#/.NET standard library includes things that are used more recently, such as threading, GUI API, sockets, etc.
Including things in the language’s standard library is very beneficial, I think, because that means they will (or should be) included in any standard implementation of the language, so you don’t have to worry about your software running only on one particular platform because one of the libraries you use only works on that platform. For instance: * Standard thread class As you say, this is simply just a threading class written for C#, but the difference is that it’s part of the.NET standard library.
Thus, you can be assured that it will be there on any platform where.NET is implemented. So, even the Mono runtime (for Linux) would include this class. * Standard GUI API WinForms is the GUI library that is part of the.NET standard, meaning you don’t really have to worry about which GUI library to choose and if you will be limited to one platform. The Mono runtime added support for WinForms a while ago, so you should be able to run WinForms apps on Linux now, rather than just Windows. * Standard sockets API Again, this is useful because many apps these days require networking support.
With C++, if you want any of these features, you have to go look for what libraries are available to support these features and also consider what platform(s) those libraries support, then how to install those libraries (if you don’t have them already), etc. It’s nice to have features that are already there, part of the standard of the language. Additionally, since C++ does not include things like a GUI library, threading, etc. In its standard library, many different projects use different libraries, so as you take a look at different C++ projects, you have to spend time getting familiar with a different library, perhaps making it compile on your computer (if it doesn’t already), etc. Also, you’ve talked about the following: * objects must have a definite value before being used I think this is actually a good feature in C#. It’s better than letting a variable have some random value based on whatever is in memory at the time the variable is allocated. Predictable behavior is better than random behavior.
Also, by refusing to compile code that doesn’t initialize variables, C#’s compiler forces you (perhaps reminding you) to initialize your variables, which helps prevent unintended random behavior. * finally block for exceptions You say this can be emulated with try-catch? The finally block is in addition to try-catch. So I’m not sure how you can emulate a finally block with a try-catch.
You also say that some C++ compilers support a finally block – But it’s certainly not a standard in C++. Again, having a feature as standard means you can (or should always be able to) always rely on that feature being there. Mirek – I’m not quite sure I understand how that emulates try/catch/finally as seen in C#. The 0 is thrown before you use the _END_TRY, so the nothing will not get thrown. And since your _FINALLY macro catches anything, the 0 that you throw would be caught by the _FINALLY block; is that the behavior that is intended?
I’m also used to seeing a finally block at the end of all the catch blocks. In C#, I had thought the finally block had to be at the end (after all catch blocks), but doing a search, maybe it’s not. As far as.NET being multi-platform, you’re right that Microsoft hasn’t put forth the effort to implement it for other platforms.
That’s something I don’t really understand..NET was designed to be a multi-platform runtime, like Java, and.NET applications can run anywhere the.NET runtime is available. I don’t know why Microsoft went through the effort to make a multi-platform runtime environment but only implement it for Windows. They probably feel that they would lose market share if they implemented it for Linux or OS X. In that case, they could have made.NET applications faster and more efficient by making.NET languages compile directly to a native executable rather than something that requires a runtime. Mono, the.NET runtime for Linux and other operating systems, was made by other companies. That is what has brought.NET to Linux, but being made by a 3rd party, it’s at least one revision behind Microsoft’s spec. The current version of.NET is 3.5, but last I heard, Mono still only implements version 2 of the.NET runtime.
Whatever can be done in C# can be done in C++. The reverse, however, is not true. C# has a huge advantage with its.NET platform.
C# has a huge disadvantge as it is limited to its.NET platfrom. The real advantage to C# is not language specific as C++ is clearly superior in that regard; it is the cost of software development, i.e. Progammers, where C# offers tremendous advantages. C# programmers need not understand the differences between pointers and references; nor must they understand the relationships between the stack, the heap and static objects.
C# programmers need not concern themselves with multiple inheritance or the advantages of the same. C# programmers need not concern themselves with coding embedded software as they cannot do so. C# programmers need not concern themselves with the intricacies of memory management, nor are they able to avail themselves of its advantages. C# programmers need not concern themselves with computing’s ‘big picture’; it is hidden from and managed for them. C# programmers will initially be more productive, but will soon plateau, finding themselves repeatedly grinding out boring and uninteresting variations of the same code. If you are desirous of a creative career in computing programming, C++ offers far more opportunities.
C# programmers will tend to be less flexible, less creative and cheaper than the experienced C++ programmer. In summary, C# is a manager’s language choice while C++ is the language choice of the programmer. Getting back to the original topic of the post: As someone who has programmed in C++ for over 10 years, it’s good to see a resource that helps me understand the differences I am running into as I start learning C#. So thanks for the original article. As for the rest of the comments, they remind me of the old C vs.
Assembler (or was is Pascal vs. Assembler) debates of a couple of decades ago. So, to add some more fuel to the fire: – What are you writing code for. C# will never be able to run on a truly embedded system where 64M (not G) of combined code and data space is huge. C++ can be used (but one has to be careful). – C++ is dangerous. As I once read “C++ let’s you shoot yourself in the foot with style.” – Discussion of the language should be separate from the discussion of the support frameworks and toolsets as much as possible.
It’s easy to throw mud at C++ and say it doesn’t have as much power as the.NET libraries for C#. But it’s like comparing a diesel motor to a car. Yes, one has seating for 5 and the other doesn’t, but they are different things.
If you really want to compare library support and frameworks, then you need to consider Qt and GTK and other C++ friendly frameworks. (I personally love Qt — it’s a lot more than just a graphics layer.) – C++ will always run on more platforms than C#, simply because of the need for the management layer.
John said, “- What are you writing code for. C# will never be able to run on a truly embedded system where 64M (not G) of combined code and data space is huge.
C++ can be used (but one has to be careful).” That’s not necessarily true. The.NET Micro Framework is designed to run on devices with very little memory, much less than 64MB (closer to 320kB actually.) The framework even includes a managed device driver model for writing device drivers in C#. The newest version of the.NET Micro Framework was also open-sourced under the Apache 2.0 license. Bartosz Bielecki – Even though I’m far more experienced with C++ than with C#, and I like C++, I can understand some of the things in C#, which you have discussed: Only dot operator: The reason C# has only a dot operator is because everything is a pointer by default in C#; C# doesn’t need two different operators for accessing object members.
When you understand the language, you won’t have a problem understanding your code, as you say. Advanced RTTI: I think it’s actually a really nice feature for a language to be able to let you analyze the objects and types you’re dealing with at run-time.
One thing this helps with is loading objects and functions from a DLL. With C++, you have to jump through some hoops to use DLLs because everything with C++ needs to be defined at compile-time.
However, C# can simply open a DLL and give you a list of the objects/functions in the DLL at run-time, which makes it easier to use the DLL. Garbage collection: While I agree with you that it’s hard to say if this is a good feature, I’ve heard people say that garbage collection can actually improve performance because you aren’t de-allocating your objects all the time. By deferring that operation, they say, you can actually get improved performance in the short term, and the garbage collection system can wait until the application is idle to collect the garbage. That said, though, I’m all for doing careful memory management, so I’m not really sure that garbage collection is a compelling feature. I see that even after 2 and half years, this thread is alive 🙂 In short; C++ is a good language which can be used only by people who knows programming and can take responsibility in what they do.
I love it because it does not come in between and let you do what you’d like to do; either good or bad. C# is designed to pull Java developers mainly emulating already familiar C/C++ syntaxes. It limits the language usage by taking care most of things [I personally don’t require Garbage Collector] that normally is the responsibility of the coder himself. Also it has made the programmers lazy. But still it’s a good language. I am amazed by the way C++ still standing amidst all wanna be best languages.
Even now, most of the high intensive applications uses C++ [AutoCad, Maya for example]. So, if you are planning something that require to operate at hardware level as well as high level and cross-platform, then go for C++. Otherwise, it’s better you go to some managed languages. I think C++ and C# both have their merits. Compared to C++, I think C# has features that can help a developer be more productive for many things, but C++ is still required in situations where you need to do more low-level tasks or tasks that are more speed-sensitive or timing-sensitive (somewhat analagous to writing in C++ vs. Assembly code). Not long ago, I read that Microsoft may phase out Managed C++.
Does anyone know if that’s true? I certainly hope not – Managed C++ provides the bridge from C#/.NET to C++ and legacy code. I imagine there are many useful libraries and pieces of code written in C++ that would not be accessible from C# were it not for Managed C++. Also, a company might have its own C/C++ codebase that it might want to re-use in C# (via Managed C++) rather than spending time (and money) re-writing it in C#. For massive scientific calculations, I’m not sure either language would be better. However, one thing I think is nice about C# is that it includes a decimal numeric type, which does math in base-10 rather than base-2 so that you don’t get binary roundoff error. I know that numeric precision (i.e., significant figures) is important in doing scientific calculations, so that could be a plus for C#.
There are base-10 numeric libraries available for C and C++, but some cost money and some can only be used in Linux or only on Windows, etc. I think most people who say they’re “done benchmarks” and found C# “x times slower” don’t actually work in the real world.
Starting with the fact that neither C++ nor C# have any intrinsic speed. That’s determined by the libraries, the compiler and the architecture its compiling for. There’s only a small handful of real world scenarios in which these artificial benchmarks have even remote relevance to what you will actually be doing. Unless you’re writing quake 5 or a number crunching supercomputer client app, there aren’t many other cases where you will feel and perf loss between native and managed code. Funnily enough, C# is being trialed for cluster computing and has been found to have surprisingly little overhead. Getting back to the real world, most applications written are fairly lax on perf and heavy on gui and logic. Most businesses that write them focus on the best cost/benefit value and realize that writing managed code is considerably faster and more maintainable than something like C++.
While working in the industry as a younger programmer, I found that many businesses still tend to avoid.net languages because their senior ‘old school’ programmers ‘hate’ the language without actually having written a single line of code in it. And I am very glad to see that as the number of younger programmers increases in the workplace, we are shifting that opinion towards objectivity and away from religious ‘i want to know what the cpu is doing’ crap. In 9 cases out of 10, C# is a better language choice for solutions in business, engineering, automation, media, data handling, etc applications; simply because you’re going to spend a fraction of dev time creating code to do the same things, if nothing else. In reply to Bicubic, I agree about the cost/benefit factors. As someone who has developed software in C++ for a while, C# seems better at letting the developer be more productive than C++.
I’m also a younger developer who has been working in the industry, but not for too long. However, I think there are perfectly valid reasons why C++ would be chosen as a development language. I suppose one reason is actually why you wouldn’t want to choose C#: C# is a proprietary language, created by Microsoft, and Microsoft has no interest in developing a C# compiler and.NET runtime for platforms other than Windows. 3rd-party.NET implementations do exist for other platforms – the most prevalent being Mono – but Mono tends to be a step or two behind Microsoft’s implementation, and there is a chance that Microsoft could do something (legally or technologically) to impair 3rd-party implementations from being developed.
This is in contrast to Java, where Sun develops the runtime for most platforms currently available. C++, on the other hand, is an open language, and compilers exist for almost all platforms. Also, I have heard that even in C#/.NET projects, C++ is used where performance is very important. C and C++ also seem more common on devices with limited RAM and storage space, although I’ve heard of C#/.NET for those devices as well.
I suppose the thing that makes me hesitate most about C# is that it’s most strongly tied to Microsoft and Windows. If a company wants to develop software only for Windows, that’s fine, but sometimes it can be important to consider making your software available for other platforms as well too. That’s just another cost/benefit ratio to consider though: You have to consider your customers (or potential customers) and try to decide how much money the company could make by making the software just for Windows or also for Linux/Mac too. Jim: No, what Dave is saying is that great power brings great responsibility. An f-16 is more difficult to safely fly than a go-cart. You are unlikely to, for example, accidentally destroy an apartment building with a go-cart, even if you have never used one before.
Also, there are things can f-16 can do that a go-cart certainly can’t. More like soccer vs jet-pack-soccer.
I don’t necessarily mean this as a reference to C# vs C++, I don’t know C# at all. But it works as an metaphor for other things such as DOS vs Linux.
Where for one example, linux is more stable but there is no undelete. C# and C I use them both 1. Coming from C++, I could say that C# is much better in my case. I am very productive using it. I could write apps faster than using C++.
And I can deliver it to the client fast. Garbage collection is a big plus. Cross platform Yes I wrote a C# app and was able to use it in Opensuse Linux (Mono) w/o any recompilation That’s a very very hugeeeeeeee plusssss.
Speed it always depends on the algorithm/flow created by the programmer I have a case wherein my boss always told me that C# is a lot slow because it relies on.NET, they have their C++ app and boasting that I could never beat it’s fastness It has lots of calculation + some hardware interactions. And after three days of development, we have a benchmark: their app takes 15seconds, and my C# app takes 1.3seconds after that, I never heard a single word from them on that day 😀 😀 😀 Speed isn’t everything 🙂 •. @Bicubic: I find your argument about ‘old school’ programmers amusing. I am one of the younger programmers where I work, but I started in computers very early. I tought myself a few languages and attended college where I learned others.
I am open to new ideas. I work with other fresh minds and most of them are all about.NET and C#.
Fact is, as I talk with them about languages and programming, it has become painfully obvious that they aren’t polished programmers. They do not know how to write tight code. They also seem to be clueless how to fully leverage C++. I blame poor teachers for this. My C++ teacher in college was terrible.
IMO, most programming teachers teach like math teachers – unable to create a compelling real-world example of why you should use specific tools and why to use them a certain way. These C# proponents I work with have decent troubleshooting but not excellent. These are sharp guys with holes in their knowledge.
Nothing personal to them or the other C# proponents, but C++ and the people that are skilled in it just seem to produce the best, fastest, most well though-out code. As someone else pointed out in this thread, C# is for beginner and intermediate programmers. IMO, it’s the programmers that are intermediate that think they are polished that seem to tout C# as the better language. While I am making a case, the argument about standard libraries doesn’t make sense to me. It makes sense if you reinvent the wheel over and over again. Any programmer is going to make a set of their own libraries they use from program to program.
While one may spend some extra time initially building some libs to make C++ friendlier for quick programming, the end game for a decent programmer is similar productivity for new programs. As a for instance, if I am writing a new C++ program that interfaces with XML, I don’t code an XML class all over again. I use the one I already made. I’d rather have my C++ libs than C# without my libs. At the end of the day, there are too many technical things to do and not enough great programmers to go around. This argument ends up as academic. C# is here to stay and C++ is here to stay.
Use the tool that matches your skill set + target hardware and enjoy bringing programs to life. I am.NET Developer for past 5 years professionally and C/C++/Python developer on personal projects. I can say that; C/C++ is all about the power in the hands of the developer and it’s up to the developer to do his job – make a better program. C# is all about simplicity. It’s good for someone who doesn’t require to know every detailed of programming [like allocating, de-allocating memory] can can start becoming a developer in flash. Even after this many years C/C++ being the top choice for development [always in top 5 for past x many decades] proves my point.
Besides, it’s best to stick to the comfortable tool. It seems to me that C++ has actually been on the decline for quite some time. I’ve been laid off a few times in the past few years, and looking at job postings for software developers, C++ seems to be a skill that’s rarely sought these days. The most common programming languages & technologies that companies seem to be looking for are C#/.NET, Java, and web development languages (PHP, ASP.NET, and to a lesser extent, Ruby and Python). These days, C++ seems to be asked for in jobs that require maintaining legacy code (where perhaps they might want to migrate to something more recent like C#) and for embedded software development tasks.
Sure does companies not look for C++ Developers. They want to develop Software fast as possible and cheap as possible to get a lot of money with it.
Most Companys doesnt care a really bit about how good the software is in the end as long they make a lot of money with it. C, C++ is the mosed used Language in OpenSource Software and the most OpenSource Software is a lot better than there commercial counterpart If i would be a company i also would use C#. Most companys develop for windows and most windows user who would by my software in the end would be not that clever and not care about memory/CPU usage at all. Especially with games. If the Software is to slow, windows users buy better hardware instead of use better software and thats what companys count for. I’ve been working in C and C++ since last 5 yrs. I also did some coding on.NET using c#, although I didn’t know C# at all.
But I’ve a doubt if reverse is true. Also, when I interview a.NET guy and I ask them to write a program to sort an array, or to swap the values of two integer variables, they look for a method provided by library. When I insist to write their own method, believe me, they have a very hard time writing a simple swap program..NET is a good library I believe, but why is it making programmers dumber! I have no clue! I find this discussion both interesting and amusing. I am a mainframe assembler programmer, looking for a good choice of language to start my 11 year old son who wants to write some simple games.
As I scroll down the discussions, I see people talking about stupid programmers needing to have the language limit them, perform cleanup tasks for them, or provide simple interfaces to complex functions and services at the cost of performance. And yet, these same people would scoff at using assembly language even though one could make the exact same argument. I think not – too many proprietary extensions and special libraries in various compilers for that to be a reality.
The real issue is time to produce a usable product. That’s it and that’s all.
If you already know C++, that’s what you will use. If you already know Java, that’s what you will use. If you already know assembler, that’s what you will use. If you don’t really know any language well, you will use the one that gets you up to speed quickly to produce something that you can get paid for.:-). Still, an interesting discussion with useful information.
Is there already an real world Programm in C# which is faster than its C++ part? C# Programmers say, since the language exists, it can be faster than C++ and over all is the best language at all. But im waiting since years and did not seen any single application.
I know some C# applicatinos which got re-written in C, C++ or Vala (Vala have C# Syntax, but the compiler translates everything into C-Code before compiling it) in case of beeing much faster than, but i never seen a C/C++ Application which got rewritten in C# in case of beeing faster. How can this be?
Is no C# Programmer on this planet interested in making applications faster? ‘ll find that the restrictions imposed by C# can be quite limiting. MI can be dangerous if used incorrectly – In my experience tho, good c++ programmers know excatly how to use MI such that MI becomes a real benefit over non MI mechanisms. Pointers are mind blowing in power when you really know how to use them.
Try using auto semantics on pointers when using them so that cleanup will be automatic if normal intent has failed. Threads may not be well supported in C++, but you can develop a framework that supports multi-threaded development very well. I’ve written my own, and find it invaluable in nearly all situations. It is beyond amazing how one can solve certain issues “simply” by using a MT approach (especially if your MT techniques produce constant stability and high performance). I intend releasing this framework to the c++ community this year or early in next. I’ve personally shut up our whole c# dept at my work with c++ solutions that out perform any c# variant by 100s of times in scalabity and performance – and I took far less time (one out) developing my solution against teams of 6-7 C# developers.
When VB & Delphi hit the scene, all the weak developers huddled around it and said that they were going to replace c++. C++ is still here, and now all those weak devs have huddled around java & c# saying the same thing as last time. Yes, C# is a good language, and I very much enjoy programming in it.
Even as a long-time C++ developer, I wouldn’t mind developing primarily in C#. Smoke: I am skeptical about your claim about C# being much faster than C++ though. It may be faster in some ways (for example, due to delayed garbage collection), but like Java, it runs in a virtual machine – basically an emulated environment. How is it that an app running in a virtual machine will be much faster than a native app? I do wish C++ had some of the same libraries that.NET does though..NET’s libraries give you so much that you can leverage; it’s really nice to work with. Here is one source. There are also several topics on StackOverflow on the subject.
(Most experts agree, C# can be faster in a number of cases, while C++ can be faster in others. Never said it was always faster.) As for the virtual environment, as far as I know, it get’s compiled to IL, executed by the JIT compiler as native code at runtime. (Read: Likely as ASM directly on the CPU, etc.) Which, means it’s not exactly running in a virtual machine, as soon as you run it, it’s compiled into native code, and executed as native code. Which contradicts most arguments on this matter.
(ie, C++ >C#, C# >C++, etc. They should technically be equivalent, but, memory management, and other factors probably come into play.) C C++ is very old, and very well optimized(which probably explains where it does beat C#), C# is new, and still getting worked on, and improved every year, I say give it another few releases, and that speed difference is going to start fading away completely.
Regardless, I like it, it get’s the job done, I’ve never seen a noticeable enough difference to warrant using C++, and as mentioned, I only use C++ for injection these days. (I’ve written games 2d 3d, compilers, particle engines, you name it, under C#, it’s always delivered.) •.
Almost everything in.Net is built with itself. (ie, as soon as the core elements were created, they started using the runtime to build itself.) As mentioned, it’s compiled to byte code by the IDE, then compiled at runtime to native instructions by the JIT compiler. That’s your answer to how it’s possible. (This is no different than C C++, it get’s compiled to assembly machine code, then executed just the same. Which is why C# is better, it’s the same damn thing, only with better syntax, better libraries, faster development times, etc, etc.).Net uses the CodeDom compiler which is written in.Net. (You can use this yourself to allow for dynamic code creation. See: LinqPad, it likely uses this technique, it’s website kinda sucks(hard to tell what it does.), but it let’s you execute code snippets directly from a textbox.) •.
Std::vector::size_type size; size = Commands.size(); std::stringstream ss; ss output; DebugPrintC((char*)output.c_str()); This kinda crap is a major reason why I dislike C++ WTF is that? Yeah, give me a ToString() method any day of the week, it took me like ten minutes to figure out how to print the size of an array, real productive language. 🙄 The C# equivalent would be. DebugPrint(Commands.Count.ToString()); There may be a better way to do that in C++, however, the point is, it’s not obvious, it takes research to do simple stuff, and waste development time. Most of all, it just p*sses me off. Why isn’t vector.size already wrapped to a standard type like int, etc.?
It should figure out internally what the hell it contains(it’s declared with a type), and how many, then give me a straight answer. Why all the hoops? C++ has the most idiotic implementations. I don’t think that C++ code is that bad, really.
And a couple things: 1. C++ lets you declare & assign variables on the same line; and you don’t even need to scope the variable type – you can also use size_t.
So your size variable could be done like this: size_t size = Commands.size(); 2. Is not an operator in C++.
The correct form would be this: ss. I guess I’ll throw in my 2 cents. I programmed C++ for many years and based what became a $35 million company on C++ code. I was never a student of the C++ language–I guess I knew a lot about it because I personally wrote around a million lines of code in it. But I was not what so many of you clearly are–students and experts on the language itself.
After I sold my company, I went to law school and have just taken the bar exam. I’m currently planning a project in conjunction with one of the world’s foremost experts on legal writing to create some add-ons for Word to do real grammar checking, add authoritative English usage references, and create built-in citation tools for lawyers. Because of this, I’ve spent the last few months updating my programming skills. I won’t do any of the programming myself, but I will do the design work and I must decide what language platform to use so I can begin to hire the right people. I’ve pretty much decided on C# for a number of reasons. Ruling out VB was easy. It’s just too shoe-horned.
Deciding between C++ and C# was a bit harder but I think C# wins the day. Here are my thoughts on why.
I can tell you that the bane of my existence for 20 years was memory allocation. Yes, C++ now has garbage collectors, but it seems risky to depend on a third-party add-on. Pointers came in second place as creating the most code gremlins. I can’t begin to tell you how many hours me and my team spent tracking down runaway pointers. Multiple inheritance? Never used it–didn’t need it. Somehow, we managed to put together an extremely complex production application that, to this day, processes 1,000,000 medical claims each day without ever giving a second thought to multiple inheritance.
Templates and STL came in third place as the cause of our issues. We finally spent an entire summer eliminating STL from our code and our system lost 75% of its compiled size and half its bugs. Dreamship: I think what you’ve said makes sense. What it all comes down to is using the best tool for the job, or what you feel is the best tool that will get your job done.
I find it interesting that moving away from the STL got rid of so many of your bugs though. What did you use instead of STL? Your only other options are re-inventing the wheel or using a 3rd-party library, which like you said, could introduce more bugs. Rather than re-inventing the wheel, using the STL should keep bugs low because the STL is a tried and tested library. I think the STL is very powerful and well-designed, too. When I program in a language other than C++, I sometimes find myself missing the STL. @Eric, You realize you’re analyzing dissecting code I wrote in like five seconds, right?
(As I said, I spent like ten minutes trying to guess how it worked, and when all logic failed, I looked it up, Google pointed me at the MSDN, and that was more or less the code they supplied.) So no, it probably wasn’t the BESTest implementation EVER! However, it wasn’t meant to be, nor was it a display of my C++ coding skills. It was however a display of how I had to go from vector to size_type to string back to char* just to accomplish what should have taken one line of code. (And does, in C#.) Also, I made it pretty clear that the forum butchered my code, for example, the “incorrect” operator was in fact, VERY correct, until the forum mangled it. 😉 And, yes, I don’t know C++ very well, which is why I said it could probably be done better, etc. As for learning the language, etc.
I don’t have the energy to get into this, but, no, I know enough to know C++ can’t compete with C#. (I gave C++ a fair chance, I don’t randomly hate things, nor was I born that way. It earned my contempt.) •. @Steve, you gotta be more specific than that. Broad response. Languages: These are just tools for us, the programmer.
If you asked me to write you a program to database your movie collection, and I gave you back the most confounding, horribly designed tool, EVER. What would you call that tool, even if the tool does in fact do what you asked, it’s just put together in a nonsensical manner? Well, that’s C++, it’s a powerful tool, it does it’s job, but, it’s put together in a way that makes little sense. I’ve learned both languages, I stuck with C#, ditched C++, because it was put together by drunken chimps, the best I can tell. Many ppl agree with this, the numbers speak for themselves, there are more amateur programmers than ever because languages like C# have made programming more accessible to the average user. Compilers: I don’t understand these, funny, I’ve been working on one for a custom language for a couple of weeks now. Runtimes: What does this have to do with anything?
I understand the.Net runtime, if that’s what we’re talking about do you? Apparently not, or we wouldn’t be arguing. Smoke – I’m sure C++ made a lot of sense at the time it was made.
Design decisions for programming languages evolve over time. C++ was made to support a wide variety of programming styles – the idea is not to limit the developer to a particular style; therefore, C++ supports both functional and object-oriented software development, multiple inheritance, direct access to memory (AKA manual memory management), etc. So while C++ may appear nonsensical or overly complex to some, there are reasons behind the design decisions of C++. I like C#, but one thing I do like about C++ is that it is a fairly universal language, due partly to how long it has been around. It’s fairly easy to find a C++ compiler for any platform.
Also, just about any other language can interface with modules written in C++ (or at least C). That’s not necessarily true for other languages. Is it possible to make use of a.NET library from Perl, for instance? I’m not sure.
The design of C++ is flexible, etc, but most of that’s possible, or not necessary in.Net. (The only real issue is multiple inheritance, which is easily solved in most cases by chaining abstract classes, or using interfaces, etc.) As for being cross-platform, why would you be? People need to knock it off and join the other 95% of the PC market on Windows. (And if not, there’s always Mono.) (As for C# from Perl, maybe, but why would you? Either rewrite your code in C#, or stick with Perl.
Also, assuming it’s not possible, the problem would be Perl,.Net can be used anywhere it’s supported.) C# has many great features that are overlooked. You can convert any.Net language to any.Net language, easily, and it can be automated. (There are many online converters(VB.Net ->C# or C# ->VB.Net), those are built using.Net capabilities.) Most everything in.Net is accessible, and usable, ie, you can even access the compiler stuff, to easily create a compiler, try writing a C++ app capable of compiling, and error checking C++ code accurately. (You can do it easily from C#, look up CodeDom, and examine what it’s capable of. Paint.Net uses this feature in a plugin which allows you to create Paint.Net plugins.
Ie, using a C# plugin for a C# application, to create C# plugins, for the C# application.:P) Most the stuff in Boost is included in C# by default. (It’s likely in there, if ya dig around a bit, ie, Google, etc.) The way C# handles dependencies alone, is superior to C++, and much easier to deal with, especially with complex source code containing various projects, each having various dependencies. (I was dealing with this earlier, I downloaded some C++ source, and the upgrade wizard broke half the settings, so I spent a long time fixing linker errors, etc. Not a real issue in C#, but a huge PITA in C++, I’ve had projects so broken, I threw em’ away, and I know they worked at some time, under some version of VC++, etc.) Reflection is one of the better features, you can reconstruct code by simply reflecting into the.exe.dll file. (I recently recovered source code I had lost by using.Net Reflector on an.exe file I had uploaded somewhere. That program has went from freeware to paid, however, free alternatives are being created. And you can do this yourself using reflection directly from.Net, it’s just more work than using a pre-made tool.) That’s just the tip of what of reflection can accomplish, btw.
I could go on, but those features alone should make it clear that.Net is a serious contender. Often, instead of thinking “why would you want to do that?”, I often like to think “why not?” Such is the case with being cross-platform. And I doubt your argument that 95% of computers are Windows machines.
These days, I think it’s lower than that. Lately I’ve been seeing more and more people using Apple’s OS X (although that still probably amounts to just 10% of the market at most), and I know of people who use Linux too. So I’d guess that Windows probably makes up maybe 90% or even 85% of the computer market these days, at least in the US. A company may or may not decide whether it’s worth the time, effort, and expense to capture the part of the computer market not using Windows. But in general, I think it’s worthwhile to think about making software cross-platform, especially for brand-new projects where it’s easier to plan for such things.
If you can make an application work on Windows, OS X, and Linux, why not? Your software will be accessible to even more people that way.
As for my “knocking it off” comment, that is of course my opinion. As I said, Mono allows for.Net to run on other platforms, I believe Linux, and possibly Mac, not sure on the Mac bit, but I do know it allows. Extract Iso Via Network Battery there. Net to work cross-platform. (ie,.Net can be made to work on whatever platform, MS simply isn’t leading the charge, likely because they don’t want to support their competitors.) While being able to do this is, I suppose nice, it’s not really necessary.
A good percentage of that 10% is composed of idiots who simply couldn’t work Windows without breaking it. The rest are just MS haters, who loathe anything, and everything MS. That again, is probably more opinion than hard fact, but, it’s based heavily on interactions with those users, they’ve never sold me on using those OS’s, and my personal experience with Linux Mac were less than spectacular.
(More along the lines, of “meh”.) All that aside, C# is very new, as time goes on it will become more accessible from various platforms. (C# is around 10 years old, but it’s only come into common use in the last 5 years or so.) Regardless, I guarantee you.Net is the future, C# is just an interface, so, whether it’s C# F#, or even C++ CLI, you can bet.Net is going to be around for awhile, and eventually dominate the market, mark my words, burn them deep into your memory, and give this post a look back in 5-10 years, and tell me I’m wrong then. I’m a longtime Windows user, but I’ve seen a similar extreme in the Microsoft camp too – I’ve seen people who love anything Microsoft makes and eat it all up, and dismiss Apple and loathe Macs (and to a lesser extent, loathe Linux as well).
It’s a belief that anything Microsoft does is the right way, and is the only way to do things. I’ve also heard from people who say they don’t trust Linux because they (mistakenly) believe that since Linux is open-source, anyone can get into the source code and potentially put in a virus or other malicious code. A misinformed conclusion, unfortunately. I’m fairly computer-agnostic. As a computer geek, I pretty much like everything. After using Windows for a long time, I tend to find myself interested in other operating systems and platforms, at least to see different ways of doing things. From a software development standpoint, if you were to think of it from the perspective of a software company, would you really want to ignore a whole segment of the market because you think its users are idiots?
That wouldn’t be a good way to do business. If you are selling your software, it would certainly be of value to you to tap into markets that could potentially bring in significant revenue. I wasn’t talking about that kind of idiot, I meant the higher tier ones, who don’t try making toast in their DVD drives, etc. 😛 (I don’t even factor these ppl into the equation, as they likely couldn’t use anything I developed anyways, unless the GUI consisted solely of two buttons, a big green “Start” button, and big red “Stop” button.) Of course you are correct, there are plenty of idiots using Windows, but, it’s user base does consist of the majority the planet, so, yeah From a developers point of view, that’s exactly what happens, very few professional developers support those OS’s, and when they do, it generally means it will run via the emulation options those OS’s have. (Most games are like this, very few AAA titles have native cross-platform support.) I’m not trying to leave anyone out, I develop for Windows, they are free to use Windows, and my programs. The main issue here, is that I’m not going to make my program harder to develop, or more complex for the sake of a few ppl, 10% may be a lot in terms of the worlds PC market, but not all of them are going to use my product, even if it were compatible, so why make more work for myself, and risk introducing issues into my program when at best I’d get 1-3% to use my application if I were lucky? It would be one thing if I were on Linux, and made my apps Windows compatible, because then, I’m reaching a larger audience, etc.
(And it’s only right since I’m the one using the oddball setup in that scenario.) But, going out of my way to reach a few more ppl is hardly worth the effort. (Especially when they have methods of running Windows apps already available to them. I know for a fact I have ppl running my C# apps under Linux using Wine, not sure about Mac.) (In my eyes, ppl using Linux Mac, are kinda like ppl that still ride those old style bicycles with the huge front tire. An oddity, or a rarity, if ya will, and I’m certainly not going to start selling big bike tires at my bike shop if ya catch my meaning.) •. First, please ingore any misstypes or spelling errors, im a bit in rage^^ @Smoke “make my program harder to develop, or more complex for the sake of a few ppl,” Thats just plenty stupid, with a good Framework on C++ (like Qt with KDElibs) you need _MUCH_ less code than in C# with.NET. But i bet you never used KDElibs because you’re a Windows guy so you think its complicated to use C++ and so you see no sense to try new things.
For me you are like those guys who use this old bicyles with a huge frong-wheel. Your last sentence was not needed at all. I dont like such type of comments.
KDE makes a lot of new awesome stuff, Linux had the first desktop with 3D Effeckts, KDE was the first Desktop with Widgets (SuperKaramba back in KDE3 times)!!! (not Mac OS X) and so on.
Other DEs copy that stuff and than those are the cool one and Linux Stuff is old shool because because they only think on a console when they think about Linux stuff. They same with C#. People dont talk about the Language C#, you dont even care about the Language C#.
People only care about.NET which makes possible to write applications without a lot of programming knowledge. Using Frameworks is nothing bad, C#/.NET People are right, why re-implement the weel. Learning how to do programming is not re-inventing the weel! It is called learning and you cant say “Why learn if other learned for me and i just can use there stuff”.
This way you will not learn! So learning is _not_ re-inventing the weel. If you learned there are tons of Frameworks, for example Qt which can handle nearly everything with just some lines of code.
I doubt that you need more code in C++ with Qt than with C# and.NET People dont compare C# with C++, they compare the.NET Framework with the Standard C Library which is useless and stupid. If you want to compare C# with C++ you have to use the same framework on both. The GNOME Project did it with GTK+/Mono. They just said, we use GTK+ on C# and on C, what was the result? The only advantage of C# is the easy syntax, so they created Vala A programming language with C# syntax which translates into C while compiling and gets compiled by GCC Why did they do that? Because they dont need.NET and that is what C# people telll about.
Without.NET there is no need for C# because C# isn’t the best language at all. The only advantage (as i told) was the syntax and a meta-compiler for C is better than investing the time to implement a C# Runtime with Framework when they use GTK+ anyway (which is better in there oppinion). Also if you create Desktop Applications there are things like KDElibs which makes it so awesome fast to create a Desktop Application. With 20 Lines of C++ Code you could create an File-Browser which can handle Webpages using WebKit, all features of Folder Viewing (using Dolphin KPart), open PDF Documents (using Okular KPart) opening Archives (Ark KPart) and so on. Qt + KDElibs = you can’t save more time while programming You have much less Code than in C#/.NET and the applications have a significant speed improvement So the Framework decides how easy it is to write applications, not the language itself. So the whole compare C/C++ vs. C# is useless at all, we mostly talk about the framework.
And KDElibs with a very lot of KDE Applications (like the GNOME stuff) works on Windows because they follow official Standards. If all people would follow official standards we would be at a very high level of programming applications and would have so many awesome stuff, but Companys like Microsoft want money, not good software. They say “Good Software is something you _have to do_ to get Money, nothing you do at your own will. We release now because now we can make the most money with a release. No we delay the release because we can get more money when we delay” Linux Community Says “I want to do good software because it is my pleasure and i give it for free to do other a pleasure. I give every release as soon i have finished it so people have the brand new stuff as fast as possible to bring it even more forward” And to talk about those people like “ride those old style bicycles with the huge front tire.” while programming for an OS of a company which does exactly that because you can make most money if you are the only one who creates bycicles is just absurd.
Stop bashing about people who are inventing new stuff while programming for an OS from an company who just steals that stuff and re-invents it to make money. Also i think its absurd that todays desktop gets more and more like “2 Buttons are 2 Buttons to many”. I know that most people use microsoft and because most people on earth cant use a computer microsoft makes there os more and more function less. That way people with knowledge go to linux and people with knowledge prefeer a console with functions than a gui without functions. That doesnt have anything to do with old shool. Those people just want and need functions.
Im always suprised how people say “wow! That was so awesome” when i used a single command to resize 100 pictures, rename them and create a HTML Gallery which gets uploaded to my FTP Server. With just one command.
They say “i would need 5 Applications and a hour to do that” and i say “Yes Windows, more gui, less function”. But Linux also have all the GUI Stuff and you can do the same thing today with 2-3 Clicks (still even much faster than every existing way on windows) in case of the advantage of the CLI goes into the GUI. Anyway, Microsoft is the reason why user-friendly linux systems needs a console at all, without the restrictions and illegal activities (recorded on wikipedia and so on) there would be no stones in the way of user friendly linux distros so no need for CLI for the sutpid users. So Microsoft want that Linux stays old shool and even while this big company works against it, Linux invented a Desktop with Widgets, 3D Desktops and the most feature rich Desktop Environment in World (KDE). Nearly everything which exsits on the Windows DE was on KDE before. I think you should rather adore the Linux Community for there respect and there will to fight against restrictions and to give there software as a gift for free than thinking of them as concurrent (they dont sell anything, how can they be a concurrent?!?) and make fun of them that they struggle with consoles on user friendly systems in case of Microsoft makes them hard as possible.
You dont have any respect for real work of people who give there hard work away for free while working for a company which wants to distroy that to get more money, than you just make me sick. “they are free to use Windows” they are not.
Microsoft gives a lot of money that people are _forced_ to use Windows, they are not free to use Windows so they are not free to use your applications. They have to pay for Windows and so get all the restrictions just to be able to use your software. At least comment i want to say. A MS Programmer told me “Developers prefeer Windows because you write an application for windows and you can be sure it will work on the future because its not opensource and suddenly everything is different” Sim City 3000 was released for Linux 2.4 (were on Linux 3.0.3 right now) and Windows 98. Sim City 3000 doesnt worked well on Windows XP and on Vista/7 it doesnt work in anyway. Sim City 3000 works on Linux 3.0.3 without problems. So on Linux it is so more easy to write applications in case of good standards and good code base (KDElibs, Qt, GTK+ and so on) than on windows (in addition you can be sure it will work in future too).
So writing applications on Windows is much harder (try to port Windows DE to Linux, no chance, KDE and GNOME can be ported easily to windows and partly have already been ported •. I have just learned C# a few weeks ago and as my first project I refactored an existing C# program written in a typical OOP “style” (using numerous objects, classes, repetetive code within case statements etc). After my refactoring it runs 166 times faster and uses less than 50% of the original source code.
If I was able to re-write it in an Assembler I would expect it to run about 300 times faster and be perhaps 5-10 times physically smaller. It would also have far LESS source lines, vastly more code interrelationships (i.e where code and data definitions automatically adjusts itself depending upon other parts of the code). High level languages are supposed to make programming easier, not harder!
I particularly cannot understand:- 1) Why C# doesn’t have a powerful conditional source code preprocessor/macro feature (other than basic #debug) 2) Why it cannot utilize procedural sub-routines (to reduce repetetive coding) 3) Why enum requires a cast to Int. 4) Why it doesn’t use EQ instead of “==” for comparisons 5) Why it had to use the OOP paradigm at all (it is now being discredited at long last after years of programmer confusion). 6) Why it doesn’t support pointers by choice (buffer overflow can be automatically checked in an interpreted/ CIL environment if designed correctly) •.
@vamp, “Thats just plenty stupid, with a good Framework on C++ (like Qt with KDElibs) you need _MUCH_ less code than in C# with.NET.” Umm, no, the.Net framework is very compact, and well optimized. You talk about using libs on top of C++, but that is MORE code, sure, the lib makes it easier to use, but, it comes with more overhead(more code), the.Net framework alleviates this by being well smartly coded from the ground up. (ie, You get all that power, and ease of use, with way less code than any C++ Lib combo, because it’s not an add-on, it’s the frameworks design.) “But i bet you never used KDElibs because you’re a Windows guy so you think its complicated to use C++ and so you see no sense to try new things.” The majority of Windows based applications are written in C++, for, oh, the last 20+ years. (Windows guy? Are you high? Windows has been dominated by C++ for years.) As for me, I CAN use C++, I choose not to, because it takes ten times as long to accomplish the same thing.
(Hmm, do I spend ten months developing my app, or a single month, decisions, decisions) “Stop bashing about people who are inventing new stuff while programming for an OS from an company who just steals that stuff and re-invents it to make money.” First off, f*ck Linux, here’s why, I can call MS, and raise hell if something goes wrong, I can make them address my issues, try that with the Linux community, and you’ll get banned from whatever forum you posted on. (Sure it’s free, but, that also means they have no obligations to help me, or to put up with my complaints, MS does.) Steals stuff, and re-invents it to make money? You mean, like EVERY SINGLE F*CKING COMPANY ON EARTH!!!
How many brands of cars are there, toilet paper, TV’s, etc, etc. That’s all everyone does in the business world, that IS business, sorry, Komrade, we’re capitalist, it’s what we do. I’m sure you work, do you do it for free, NO, you have bills to pay, and so do they, how about all the jobs Linux is costing ppl? If everyone used Linux, and dropped Windows, that would put THOUSANDS of ppl out of work. “I think you should rather adore the Linux Community for there respect and there will to fight against restrictions and to give there software as a gift for free ” See above: This may seem great, but, MS charges, and in turns pays employees, they help create jobs, which helps our economy, Linux does not. (Hippy ideals don’t pay the bills.) “Sim City 3000 doesnt worked well on Windows XP and on Vista/7 it doesnt work in anyway.” Wrong, I’ve played Sim City 3000 on Windows 7, and XP, it does work @Ken, really, you can write something in ASM and it’s faster? No sh*t sherlock, ASM creates the fastest code, faster than C C++ C#, or anything else.
HOWEVER, try developing a game like Doom 3 in pure ASM, and let me know how it works out for ya. Also, you rewrote your code to be more efficient, it was more efficient, and you blame the language? /walks away •. If it were a free model as Linux intended, and not a company selling software built off of Linux, then no jobs would be created. They happen to create jobs in this case due to the same ideals that drive MS, being employed by companies like IBM Google, not on the account of anything Linux did by being freeware. I see no comparison between the two scenarios. Linux does not create jobs by being freeware, capitalism created the jobs, it was these other companies seeking to make profits that are responsible for that.
I’m not against freeware, I release much of my work for free as well, but, until we live in a more ideal world, things are what they are. Yeah, here’s some code from the “real” world, from these so called “real” programmers. FtImage print(640, 480); //This will store the string of text we print Sprite Text; print.setFont(fthenameofthefontinthedatafolder_ttf, thenameofthefontinthedatafolder_ttf_size);//Set the font we are using print.setSize(32);//Set the size of the font (should be a multiple of 4) print.setColor(Color::Color(255,40,40));//Set the color of the font in RGB format Text.SetPosition(100, 50);//Set the position of the starting point of the text we will print Text.SetImage(&print);//Append print as the image stored by Text print.printf(' Hellow World! N'); print.flush();//Tell the computer that the string of text is ready Text.Draw();//Render the text print.clear();//Clear the stored string of text print.reset();//Bring us back to the render starting point (defined by Text.SetPosisition()) ———————– I’ve written a number of text rendering functions myself over the years, and I guarantee you, that not one of them, requires that much code to be used.
Your boasting sounds good on paper, but, in reality, C++ code generally sucks, and is generally much more complicated to use than it ought to be. A text rendering function is ideally a one liner, anything more is ridiculous. (Btw, I’m fairly certain that this code was developed by a Linux user, so there goes your entire theory.) ——- In other words, you’re f*cking delusional, C++ produces just as many bad programmers, and just as much bad code, as any other programming language. (Linux Windows, have nothing to do with it either.) Choosing a specific OS language does not automatically make someone a better programmer, you’re either a good programmer, or you’re not. ——– Let me explain something else to you: I see the presented usage of a library, in the same way most ppl view a GUI in an application. Which is a fair comparison, when creating a library, you are creating a user interface, ie, some poor sap has to interface with your code, I think you’d do well to remember this.
Anyways, ask yourself, given the code presented above, and a function with a prototype like this. Void RenderText(params); Which would you honestly rather use? —- Personaly, I’m sick of having to type 20 lines to do something that should take one, I’m sick of re-inventing the wheel, because some assholes gave me a square and called it close enough, I’m sick of having to do other ppls jobs for them, because they fail at coding. And you know what, I encounter this problem with C++, more than any other language, which is funny considering how high mighty you guys think you are.
As I said, there are good C++ programmers, and C++ can produce good code, however, that’s not an absolute, and more often than not it seems, it produces fail coders, who just think they’re good. Fix your f*cking HTML code tags. Here is the code again. FtImage print(640, 480); //This will store the string of text we print Sprite Text; print.setFont(fthenameofthefontinthedatafolder_ttf, thenameofthefontinthedatafolder_ttf_size);//Set the font we are using print.setSize(32);//Set the size of the font (should be a multiple of 4) print.setColor(Color::Color(255,40,40));//Set the color of the font in RGB format Text.SetPosition(100, 50);//Set the position of the starting point of the text we will print Text.SetImage(&print);//Append print as the image stored by Text print.printf(” Hellow World! N”); print.flush();//Tell the computer that the string of text is ready Text.Draw();//Render the text print.clear();//Clear the stored string of text print.reset();//Bring us back to the render starting point (defined by Text.SetPosisition()) •.
In other words, you’re f*cking delusional, C++ produces just as many bad programmers, and just as much bad code, as any other programming language. (Linux Windows, have nothing to do with it either.) ——————– This coming from someone who doesn’t use the proper slashes to mean “or”. Normally you’d use / for that, not. ——– And you know what, I encounter this problem with C++, more than any other language, which is funny considering how high mighty you guys think you are. As I said, there are good C++ programmers, and C++ can produce good code, however, that’s not an absolute, and more often than not it seems, it produces fail coders, who just think they’re good. ——– Regardless of the language, people who write bad code probably shouldn’t be producing software.
Unfortunately, though, I’ve seen my fair share of people who get real software jobs who can’t seem to write decent code – even down to poor and inconsistent formatting, so that it’s hard to read. ————- I’m sick of re-inventing the wheel, because some assholes gave me a square and called it close enough ———— The same may be said about C# in 10 to 15 years. I’m sure C++ and its STL, etc. Was originally considered a rich library. At the time, it had what many people needed in a library to do common tasks.
Now, many tasks that people do are different – but there are new libraries too. Just last year, the new C++0x standard was ratified, so now the Boost C++ libraries are part of the standard – Boost has some fairly nice stuff. “This coming from someone who doesn’t use the proper slashes to mean “or”. Normally you’d use / for that, not.” It’s just a delimiter to me, I leave it up the reader to figure it out based on context. 🙂 Congrats though, you are the first person in nearly 15+ years of online activity to say a word about it. (I’m waiting for someone to call me on my abuse of “etc”, seriously, I use it a LOT.) 😛 “Regardless of the language, people who write bad code probably shouldn’t be producing software.
Unfortunately, though, I’ve seen my fair share of people who get real software jobs who can’t seem to write decent code – even down to poor and inconsistent formatting, so that it’s hard to read.” No arguments here, that was my point as well, Vamp claimed that by nature, using C# made one a lesser programmer, I was pointing out that bad code, comes from bad programmers. (With C++ being one of the most used languages, obviously, it would suffer more, Java is another, and as you said, C#, as it becomes more popular. No language is immune, really.) “The same may be said about C# in 10 to 15 years. I’m sure C++ and its STL, etc.
Was originally considered a rich library. At the time, it had what many people needed in a library to do common tasks.” Again, no arguments, the longer C# stays around, the more the issues can compound, one bad lib, leads to another(a domino effect).
But, the core libs are well coded, and have some good standards, so at least the majority of the problems should be confined to 3rd party libs. (Assuming MS doesn’t drop the ball on their end.) “Boost has some fairly nice stuff.” Yeah, I’ve used boost(not extensively, but.), it was one of the good C++ libs I was referring to, though, I still prefer the C# way, but that’s just my opinion, I prefer the verbosity of C#, and it’s generic system really suits my style of coding. (I really like how you can use generics with Linq, and lambdas, and get nice shortcuts, but still keep understandable code, everything can work together so cleanly and to great effect.) Regardless, I think we can agree, the problem is bad programmers, and in the case of C++, it’s heritage hurts it as well. (ie, it’s heavy use of shorthand naming(cout printf), which was of course due to limitations in the hardware of the time, and bandwidth issues, etc.) @All, In the end, use whatever language you prefer, but, use some standards, and think about your implementations, and how they’ll be used, and encapsulate abstract wherever possible. (Also, pick some standards, and stick with them.) There is a.zip file, under the text “send me a link” it’s a hyperlink in the article, it contains a.pdf with one companies ideals of standards, I read through this myself, and found, I do nearly everything the same, though, we do disagree on a number of points, still, a decent list of standards to follow. You may also want to look into design patterns, I like interface abstract class based designs myself(very extensible), I used to have a link to page with various design patterns that can be used for different scenarios, but I seem to have lost it.
I am learning C# for the first time.I am on page 75. To give you an Idea of my Experience.
All of this is greek to me., My point in commenting; I came here to see if I was better off Learning C# or C++ as I didnt want to invest much time on something only to realize **”OH SHI*, i cant build this with C#?, or a job doesnt want to hire me because I learned the wrong programming language.” Furthermore; your outline in comparison and the comments that followed painted a pretty good picture and helped build some confidence in me about studying C# over C++. But, I have a feeling I will be learning C++ in the future for some reason that isnt clear to me now. (popularity, History etc) My interest would be to create games(like eq2)(programming with gui programs that assist with creating games like UNITY3d platforms) and Other Business type applications in the future. Also, Windows application that would be similar to allow users to clear out the SAM file on windows because an ex employee changed the server password. (Savvy?) — Is it possible to see if C# is best for me?
Thanks in advance! If you’re going to talk about parallelism and concurrency, you need to be demonstrating it in Ada.
That’s the bottom line. When you get into pthreads and the multithreading models that are so involved in C/C++, you’re also tying yourself to operating system dependence. It’s really easy to get lost in senseless coding. The problem with teaching concurrency in a byte code compiled language like Java or C# is that you get too far away from the OS and off into this magical wonderlands of objects. Ada is a happy medium between the two of them. Ada’s syntax, library, compiler (GNAT), and type checking system is delectable.
Lot of arrogance here with the “real programmers use C++” attitude. I’m surprised those who deride C# for having hand-holding training wheels, don’t realize that that’s the whole point of high-level languages: To make things simpler for the programmer. Well I think people who program in C++ are lazy tyros who need a crutch, as real men program with front panel toggle switches. 🙄 In the real world, the importance of sheer runtime performance (or more accurately, efficiency) isn’t as important as it once was. The computer spends nearly all its cycles waiting for the user or other hardware to do something. If the user does something and it takes C++ 2ms to complete and C# does the task at an agonizingly slow 3ms, is that an acceptable trade-off if you can get the C# app to market significantly faster?
Of course, there are plenty of cases where ultimate performance matters. There’s apparently lots of programmers, at least posting here, who write full blown commercial games and operating systems. They shouldn’t even touch C#.
It’s neither intended, not is it appropriate for those. For most of us, performance needs to be weighed against other factors: Time to develop; time to test and debug; stability; compatibility; maintainability Then, and only then, does a good programmer decide which language is “best”. But I guess if all you have is a hammer++ And I suspect everyone championing creative, more that one way to do it, outside the box power programming have never been tasked with maintaining a b’zillion lines of code written by a creative, more than one way to do it, outside the box power programmer. To begin with: Congrats! This thread is 6 years old and still active 😀 Again, it’s what you want to do comes first and then comes what you want to use to get what you want, then the third, how good are you with what you want to use to get what you want.
So, even if you want hardware level interaction, but you are good with C# than C++ (let’s agree, most of the guys haven’t used C++ except for colleges), try to figure our what are the libraries that supports the level of programming you want (unsafe namespace with pointers inside for example). If you are well versed with C++ (or willing to spend some time to learn it), then I’d suggest you to go for C++. Again, it’s what you want, with what you want and how comfortable are you with what you want to use to get what you want. I am a C# programmer and am currently teaching myself C++. I haven’t read all the comments so forgive me if I retread over something already stated.
Your choice of programming languages deal more with what you plan to program, not simple pros and cons. If you want to create high perfomance graphics programs for Windows, I recommend C++, If you are creating non-graphics intensive applications C# is great. Learn Java, HTML, or XAML for web. I learned C# in college. I am learning C++ so I can program DirectX-based apllications. The platform for which you want to program is far more important than a few pros and cons. LOL My god people fight for anything.
I have learned the best language is the one you know. I know C++ has better performance but at what cost?
Since most of its codes are unsafe. I’m not bursting C++ though it IS indeed one of the best languages of all time one of mi fav in fact. But C# is safer I’d say and more straight forward. But this is not a point to a fight since BOTH will do just what you want, as mentioned some times C++ is more viable since the faster factor of it. But again we are in the “Monster-PCs” age so no complains I guess LOL.
Trackbacks & Pingbacks •.