C # for win32 or c ++

I know that programming in C ++ is more complicated than C #. Because we have to create WNDCLASS and initialize it and use the Funcs API and ...

But my question here, for Windows programming, is C # better than C ++?

If so, why are large programs created using C ++.

+4
source share
4 answers

Its not "big programs" when C ++ prefers managed code in C #.

There are restrictions on what can be done using managed code, for example, you cannot write hardware drivers or other programs that interact with the hardware. You cannot even access all Win32 APIs from exclusively managed code. Some programs have high performance requirements and are therefore more suitable for C ++. Sometimes C ++ is used simply because a software company has experienced C ++ developers. Sometimes C ++ is used because developers do not want the software to depend on the .NET platform (which is not installed out of the box in XP and earlier versions of Windows). Sometimes C ++ is chosen so that a cross-platform application can be developed.

In a broad sense, C # is easier to learn and is a more powerful and productive language and framework than C ++ / MFC / COM, etc. But C ++ is a very wide tool and can create solutions for many very diverse problems: from writing operating systems, real-time systems, embedded applications, databases, business software, desktop software, server software, libraries / frameworks and etc. etc.

C # is better for a certain class of problems. It is largely limited to running on Windows (with the exception of Silverlight and Mono). C # is suitable for rapid application development, which means it is better for one-time user software such as many internal applications developed in large organizations. And, as I said, it is more suitable for developing desktop and server applications compared to drivers and other low-level software.

If you look at which language to start learning, a reasonable choice would be: C, then C ++, then C #. This will give you the foundation you need to become a really good object oriented programmer, with an understanding of how lucky we are with C #! If you don't have 10 years to save, then go ahead and start with C #. No matter what you do, do not start with C ++, or you will most likely give up your programming career in desperation and join a circus where everything makes sense.

+8
source

If I could start from scratch all the C ++ projects that I have done in the past, 99% of the code would be in .NET. Especially when it comes to the user interface. WPF, Winforms is much more powerful than MFC.

What program will you develop? Please clarify, and then we can make a recommendation.

** EDIT

A good example is Visual Studio itself. VS 2010 is based on WPF now.

+4
source

it is better? Better how? Take it easy? Faster?

C ++ is a monster to learn, huge and complex as it is. C # is much friendlier and easier to work with. C # often allows you to complete tasks faster and easier than C ++, because the language and its structure do a lot of work for you. This is part of what makes C # better than C ++, and what makes C ++ better than C #.

If you let C # do the work for you, it means that you, as a programmer, sacrifice some control. This is what sets a high-level language apart from a low-level one. For demanding applications, programmers tend to choose a language that provides the necessary abstraction, while maintaining the necessary control. This is why many complex applications (such as video games) are written in C ++. It has a fairly large set of high-level functions, while still packing power to pull really low-level code for situations where you need absolute control over the equipment. That is why many business applications and other less demanding applications are written in a high-level language such as C #, because these applications are not suitable for low-level functions and can safely take advantage of high-level applications without worrying about performance penalties.

In C #, all applications created with it run in the .NET runtime. This is a drawback for programs that need to be run quickly, because you want to be as close to the hardware as possible. Thus, C ++ wins for demanding applications where critical speed or memory usage is critical. C ++ can also be used on a very large number of platforms, from PCs to coffee machines (well, cell phones, then), and C # is officially limited to platforms running Microsoft Windows.

Regarding ease of development in Windows, C # is a clear winner. There are also frameworks for C ++, but they are not even close to C # when it comes to making things quick and easy. Nevertheless, it is quite possible to write complex graphical applications for Windows in C ++ without unnecessary curses.

In any case, I hope you see how little point it is to compare languages ​​like this. This is very similar to comparing a hammer with a screwdriver. Choosing a language is choosing the right tool for the job. Many tools overlap - you can do almost the same thing in C ++ and C #, which complicates the choice. If you really want to read this (going for an "educated choice"), I suggest you familiarize yourself with the individual languages. If you're just curious about what language you need to learn, I suggest you start with C # and learn C ++ if you ever need (or want).

+4
source

C ++ and C # are both really good languages, saying that they have their own characteristics.

C ++ is ideal for applications that require highly optimized memory and CPU usage, such as low-level driver development

C # is much better for creating business applications, such as accounts and database-enabled applications, that will take age if you try to create them in C ++

In short

C++ is for applications which require highly optimized memory and CPU usage. C# is far productivity and enterprise applications 
+3
source

Source: https://habr.com/ru/post/1338516/


All Articles