• 0

is c# better then c++?


Question

Recommended Posts

  • 0

C# is arguably an easier language to get into that C++. A lot of the management is done for you, memory, and so on. However, there is an underlying feeling that C++ is more powerful overall if you want to jump down to the depths (I can't argue either way on this, I make apps that don't require me to go THAT deep).

As for Linux, yes - there is MONO, but it's a port, it's not pure C#.

  • Like 1
  • 0

To decide which is better we need to know what you want to use it for. It's a bit like asking which is better, a Ferrari or a Mini van? Each has their uses and pros/cons, and if you make the wrong choice you will find things very difficult.

C++ is ultimately more powerful, and allows you much finer grained control. It is essentially the language that most of the big OSs are written in. But for most of us normal programmers their is no need for that level of control, especially when you consider that if you get it wrong things will go disastrously wrong very quickly. C# will be easier to learn, and if nothing else will give you a basic grounding that you can use to move up to C++.

  • Like 2
  • 0

C# is arguably an easier language to get into that C++. A lot of the management is done for you, memory, and so on. However, there is an underlying feeling that C++ is more powerful overall if you want to jump down to the depths (I can't argue either way on this, I make apps that don't require me to go THAT deep).

As for Linux, yes - there is MONO, but it's a port, it's not pure C#.

c# is an open standard, mono is an implementation of that standard as it the .net framework. afaik

  • 0

Yes, C# is better than C++. It's much more elegant and doesn't have much of the legacy stuff that comes with C++. Whether or not you want to use it as a learning language is more a personal preference thing. I tend to recommend C++ over C# for learning, since it gives you experience with lower level concepts such as pointers, whilst still offering object-oriented goodness, but C# allows you to dive straight in more easily and handles all the lower level stuff for you.

C# is supported (as others have said) on Linux through the Mono project, so it's perfectly usable on Linux. You may come into ideology conflicts with Linux users if you create software using it though :)

  • 0

Short answer: C# is far easier to learn if you're just starting out.

Long Answer: C# is far easier to learn, but you never really have to learn about memory management with C# which is an important part of software development. Though, it's arguably less relevant in C# because it's a managed language. You can always use C# to learn the ropes of object-oriented development, and then go back to focus on memory management in an unmanaged language like C++.

C# also has better tools, which can make it significantly less frustrating to develop. You can use Visual Studio for both languages, but C# has syntax highlighting, type-ahead, intellisense, and all other modern features of IDEs built into the language (it's a .NET language after all). C++ has some intellisense, but no highlighting or anything else. For beginners, this might be a huge obstacle.

For 99% of anything software developers will ever have to do, C# a good choice. For the other 1%, videogame development, C++ is arguably the better choice. And by "arguably" I mean C++ is only better if you're planning on writing the next Unreal Engine. C# is actually very capable for making small 2D and 3D games.

  • 0

IMHO C++ is better; one of the first and foremost reasons is RAII which lets you manage resource (notice the difference here: GCs only manage memory!, but memory is the least dangerous garbage you may produce in a [modern] system?) in arguably the cleanest way possible - as you don't have to do anything yourself?

Another big advantage is that the whole library is developed under strict control in terms of runtime complexity - a feature you'll never be able to find under C? (or Java for that matter)?

  • 0

What's with all the soft wording :\

C++ is a much more powerful and faster executing language. Depending on the compilers you are using, you can even insert compiler code directly into the app for those processes you want to scream along. C++ runs as native code. It's compiled to be as efficient as possible on which ever platform you run it on. It's far "lower level" and lacks a lot of niceties that higher languages possess (such a Just-in-Time debugging).

C# is far FAR faster to deploy in. It is also far more forgiving of mistakes. In the process is being so, it is also far slower. Where as C++ runs code that is compiled directly for the CPU, C# runs as a managed language. You don't have to worry about assigning memory as the CLI handles that for you. You can make small mistakes in your code and have it continue to run. You can't do as much (but it's fairly negligible a difference for the average coder).

Personally, given the work I do, I much prefer C#. I enjoy the niceties of the .net framework (this should be what ultimately makes the decision for you). That said, I personally believe that if you want to be a serious coder, you should learn on C++ so you know exactly what C# is handling for you in the background. That way you will realise exactly how much CLI handles and why it's so much slower than C++ for HPC uses.

tl;dr - C++ first then C# if you plan to be a serious coder. C# first and no C++ if you don't care.

  • Like 3
  • 0

My vote goes to C#. It's still a C Based language so it feels very close to C++ albeit cleaner. The .NET Framework provides most everything you need, anything else can be made using the framework and piecing parts together. I spend 90% of my work day in C# and it is a great experience.

  • 0
What is easier to learn?
C# and by far.
does it work on linux?
C++ has gcc and clang for compilers, as well as a few different IDEs, while C# has mono and the monodevelop IDE. Contrarily to some resilient myths, mono is not "unpolished" or "dangerous" or such. It's every bit as polished and alive as any C++ compiler on Linux, and a quality solution used by professionals.
there is MONO, but it's a port, it's not pure C#.
Mono is an implementation of open standards just like gcc or clang. I don't know what you mean by "pure C#", as Microsoft's .NET itself is written in C++.
In the process is being so, it is also far slower. Where as C++ runs code that is compiled directly for the CPU, C# runs as a managed language
C# is also compiled to machine code, it just does so usually "Just-in-time" rather than always ahead of time like C++. While C# does make compromises on performance where C++ makes none, it still offers comparable level of performance in most cases, and saying it's "far slower" is an exaggeration. I'd even say that it's easier to write fast code in C# than C++, leading to faster programs given the same time constraints.

Of course if what you're writing is scientific high-performance computing code, then C# isn't what you should be using, but I'm talking about the general case.

Another big advantage is that the whole library is developed under strict control in terms of runtime complexity - a feature you'll never be able to find under C?
I've heard that from Herb Sutter and it's quite amusing. Yes, most of C++'s library has its complexities documented, but maybe because there isn't much more than containers and algorithms in the C++SL... Containers and algorithms in .NET also have their algorithmic complexities documented, but there is no point documenting the algorithmic complexity of a Printer or Socket class.
But if you want to learn about pointers, you have to go with C++.
There are pointers in C#. And reference vs value types is basically the same idea as pointers vs values in C/C++.
  • Like 2
  • 0

It's not like C++ is "hard" like assembly.

IMO if someone finds c++ hard to learn then maybe a job in computer tech is not for him/her. Or maybe it explains why so many apps are slow as hell these days.

This said c++ is kinda "dead". Last time i saw a job requiring c++ knowledge was a long time ago. Most jobs theses days require .net, java, php, mobile frameworks, etc or old languages like cobol or sas for jobs in banking and inssurance (anyway where i live might be different for california ;).

c++ is mostly used for video game engines and by scientist for simulation and such (or in old programs made with it). Basically it's used for things that can stress a computer. And for such jobs usually c++ may be not enough as you need to understand assembly too and need to have a very good knowledge in algorithmic and mathematic (anyway last time i checked there was still some assembly used).

If your goal is to learn and become a computer eng then you should start with c++. I would even go as far as to say you should start with assembly. In fact you should start with mathematic as it's the basis of being a computer eng. It's more important to learn the concepts first. Starting with the language is not a good idea. You can learn mathematic and algorithmic and oop concepts without even using a computer.

If you goal is to write a simple linux app and you don't care about being a good dev then c# if mono is good (can't say never used mono). It's definately easier.

  • 0

C# is far FAR faster to deploy in. It is also far more forgiving of mistakes. In the process is being so, it is also far slower. Where as C++ runs code that is compiled directly for the CPU, C# runs as a managed language. You don't have to worry about assigning memory as the CLI handles that for you. You can make small mistakes in your code and have it continue to run. You can't do as much (but it's fairly negligible a difference for the average coder).

Even C# is compiled to native code. But that is done by the JIT compiler on first run. This is a common myth.

  • 0

What is easier to learn

It depends how you look at it. If you already know how to use the OS facilities and third party libraries, then I'd say C++ is generally quicker to learn. By generally, I mean the common stuff, basic OO, commonly used STL classes, etc. And if you already know C, learning C++ is made that much easier.

With C# you'll need to learn both the language and the dotnet library. In terms of difficulty, it's probably on about the same level as Java. After all C# was Microsoft's answer to growing Java use.

and does it work on linux?

I wouldn't recommend using C# or dotnet outside of Windows. Its support is sketchy at best, and most Linux distributions are blacklisting it (Mono) due to precarious licensing issues. Furthermore, the proprietary Windows Forms also won't be available outside of Windows, so if you intend on writing a GUI application, you will have to use something else.

If you want to run your code on GNU/Linux or support multiple platforms, C++ is the better option. It's well supported across every major platform, and there are free open source tools aplenty to aid in development. You can even write a Windows C++ application inside of Linux with GCC cross-compilation and Wine for testing.

  • 0

c# is an open standard, mono is an implementation of that standard as it the .net framework. afaik

Actually it's not an open standard because Microsoft controls it and nobody else has input on it. It's a registered standard with EMCA, but that's as far as it goes. It's also patent encumbered, so there's a risk in the future that other implementations could get shutdown. It's best to avoid those headaches. At least C++ is a true open standard.

  • 0

I'm surprised nobody has said Java yet. Eclipse is a great free Java IDE, Java and C# are almost the same language, and Java is perfectly cross-platform, including GUI's.

I'm studying Applied IT and have been writing Java since september now. I've always used Eclipse with it, but I feel right at home in Visual Studio using C#. No reason to limit yourself to Microsoft with C# right from the beginning.

(in fact, C# is strongly 'inspired' on Java. But Java sort of forces you to write cleaner code (in my opinion), which will help you later on)

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Windows 11 version 26H2 is now available for testing in the latest preview build by Taras Buria Friday Windows 11 preview builds are here. Insiders in the Experimental (formerly Dev) and Beta Channel can download builds 26300.8697 and 26220.8690. There are no new features, but Microsoft is officially moving the Experimental Channel to version 26H2. In addition, Microsoft is improving the copy dialog in File Explorer, the Start menu reliability, and fixing virtualization issues. Here is the changelog: [General] With today’s build, Windows Insiders in the Experimental channel will see the versioning updated under Settings > System > About (and winver) to version 26H2. For more information, see the Windows Insiders blog. [File Explorer] We’ve improved the visual consistency and reliability of the Copy dialog in Dark mode, including its launch experience and the expanded progress view. [Start menu] - Also available in Beta Improved reliability of Start menu reflecting newly installed or removed apps without requiring sign-out or restart. [Taskbar] Fixed an issue for Insiders using the new smaller taskbar option, where the system tray might get cut off or pushed off screen. [Settings] - Also available in Beta Improved reliability of Settings > Apps > Startup. [Virtualization] - Also available in Beta This update addresses an issue that could result in bugchecks citing HYPERVISOR_ERROR (0x20001) and KMODE_EXCEPTION_NOT_HANDLED (0x1E) errors after installing the latest flights on some devices during system restarts, virtual machine operations, or while running some gaming applications. You can find the official changelog for the Experimental build here and for the Beta build here.
    • I've always preferred this possibility. There is something that feels good about the idea that all matter in the universe will eventually come back together and maybe even result in another big bang. The idea that the universe would fizzle out over the eons and forever drift apart is a little depressing. I realize it is not logical to let a basic human desire for life to have a grand everlasting meaning change the way I feel about a scientific theory, but I am human, so that is how I feel :-).
    • Windoze 11 could finally go to hell, instead of making me savor yet another error I've never had. "Bad Pool Caller" or whatever TF cryptic crap0la message it is. Adding salt to injury, it says something along these lines (on the blank black screen after it hard stops): "Your windoze needs to restart. You can restart." NO WAY SHERLOCK. The PEECEE, look, it's *blocked*, I can do jack sh1t with it as it is and you say that it needs to restart? Further, that I can restart? What am I supposed to do, take a herbal bath? Sudo a sandwich? Timewaster pile of useless slop and errors, coded by monkeys and force-fed on us by a pedo-founded corporation, that's all there is to it. Now, let's have a fun weekend trying to handle the error, which after a quick internet check can basically be due to EVERYTHING, from memory faults to drivers to motherboard issues. Thanks M$.
    • Zen Browser 1.21.3b by Razvan Serea Zen Browser is a privacy-focused, open-source web browser built on Mozilla Firefox, offering users a secure and customizable browsing experience. It emphasizes privacy by blocking trackers, ads, and ensuring your data isn't collected. With Zen Mods, users can enhance their browser experience with various customization options, including features like split views and vertical tabs. The browser is designed for efficiency, providing fast browsing speeds and a lightweight interface. Zen Browser prioritizes user control over the browsing experience, offering a minimal yet powerful alternative to traditional web browsers while keeping your online activity private. Zen Browser’s DRM limitation Zen Browser currently lacks support for DRM-protected content, meaning streaming services like Netflix and HBO Max are inaccessible. This is due to the absence of a Widevine license, which requires significant costs and is financially unfeasible for the developer. Additionally, applying for this license would require Zen to be part of a larger company, similar to Mozilla or Brave. Therefore, DRM-protected media won't be supported in Zen Browser for the foreseeable future. Zen Browser offers features that improve user experience, privacy, and customization: Privacy-Focused: Blocks trackers and minimizes data collection. Automatic Updates: Keeps the browser updated with security patches. Zen Mods: Customizable themes and layouts. Workspaces: Organize tabs into different workspaces. Compact Mode: Maximizes screen space by minimizing UI elements. Zen Glance: Quick website previews. Split Views: View multiple tabs in the same window. Sidebar: Access bookmarks and tools quickly. Vertical Tabs: Manage tabs vertically. Container Tabs: Separate browsing sessions. Fast Profile Switcher: Switch between profiles easily. Tab Folders: Organize tabs into folders. Customizable UI: Personalize browser interface. Security Features: Inherits Firefox’s robust security. Fast Performance: Lightweight and optimized for speed. Zen Mods Customization: Deep customization with mods. Quick Access: Easy access to favorite websites. Open Source: Built on Mozilla Firefox with community collaboration. Community-Driven: Active development and feedback from users. GitHub Repository: Contribute and review the source code. Zen Browser 1.21.3b changelog: New Features Updated to Firefox 152.0.1 Fixes Fixed transparency not working after updating to 1.21.2b (#14259) Fixed frequent crashes affecting users with Intel Raptor Lake processors Fixed an issue on macOS where choosing a PDF option, such as "Save as PDF", from the system print dialog would send the job to your printer instead of saving a file. Other minor bug fixes and improvements. Download: Zen Browser | 90.2 MB (Open Source) Download: Zen Browser ARM64 | Other Operating Systems View: Zen Browser Home Page | Screenshots 1 | 2 | Reddit Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • Get 1-year and $60 of Sam's Club value for just $15 with Auto-renew by Steven Parker Become a Sam's Club Member Now! Shop Premium-Quality Products and Enjoy Incredible Perks, and Savings. Today's highlighted deal comes via our Gift Cards section of the Neowin Deals store, where for only a limited time, you can save 75% off a Sam's Club 1 Year Membership with Auto-Renew. Sam’s Club is a membership warehouse club, a limited-item business model that offers members quality products at an exceptional value unmatched by traditional retail. From groceries and kitchen supplies to electronics and furniture, Sam's Club has great deals on the items you want! By redeeming and signing up as a member, you'll be paying just $20 for a 1 year Sam's Club membership (normally $50.) You'll receive a complimentary household card for more savings from already low-priced items. Sign up now and save money on all your food and decor. Find great deals on groceries, kitchen supplies, electronic, furniture & more Get discounts on hotels, rental car, live events, attractions, movies, & more Save up to 60% on hotel accommodations around the world Get a complimentary household card for more savings from already low-priced items Although it was published quite some time ago, Sam's Club members can enjoy discounts like this. Important Details For a physical membership card after online membership registration, present your phone number or email along with a valid ID at Sam’s Club Membership Services in any US Sam's Club location to have your membership card printed. This membership offer is only available to new Sam's Club members in the USA. It is not valid for membership renewals, for those with a current membership, or those who were Sam’s Club members less than 6 months prior to the current date. To check your renewal date, please check your billing statement or your online account, or chat with an associate. Promotion code is non-transferable Offer valid for new Sam’s Club members only; not valid for membership renewals, for those with a current membership, or those who were Sam’s Club members less than 6 months prior to the current date. Auto Renew: By accepting this offer, you authorize annual recurring charges to any card on file for your Sam's Club membership fee(s) plus any applicable taxes at then-current rate every year until you cancel. Current rates, which may change, are $50 for Club level and $110 for Plus level. Visit SamsClub.com or a club or call 1-888-746-7726 for full terms or to cancel auto-renewal. Valid at over 597 U.S. Sam’s Club locations. Find a location near you. Redemption deadline: redeem your code within 30 days of purchase Access options: desktop & mobile Membership MUST be activated within 30 days Membership expires 1 YEAR from the date the Sam's Club membership is activated Limit 1 per person, may buy 1 additional as gift This Sam's Club 1 Year Membership normally costs $60, but can now be yours for just $15, for a limited time, that's a saving of $45 (70%) off! For specifications, and terms, please click the link below. Get 1-year of Sam's Club with Auto-renew for just $15 (was $60) This deal is only available to U.S. residents. Support queries If you have queries or need support for any of the Neowin Deals, please use the contact form here. Neowin Deals are managed and sold by StackCommerce who represent Neowin on an affiliate basis. Why we post these deals We post these because we earn commission on each sale so as not to rely solely on advertising, which many of our readers block. It all helps toward paying staff reporters, servers and hosting costs. So for those that keep moaning and complaining, be thankful we're still online for you to even do that. Other ways to support Neowin Whitelist Neowin by not blocking our ads Create a free member account to see fewer ads Make a donation to support our day to day running costs Subscribe to Neowin - for $14 a year, or $28 a year for an ad-free experience Disclosure: Neowin benefits from revenue of each sale made through our branded deals site powered by StackCommerce.
  • Recent Achievements

    • Collaborator
      ryansurfer98 went up a rank
      Collaborator
    • Week One Done
      Eurosoft10 earned a badge
      Week One Done
    • One Month Later
      Eurosoft10 earned a badge
      One Month Later
    • One Year In
      Skeet Campbell earned a badge
      One Year In
    • One Month Later
      Sharbel earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      578
    2. 2
      +Edouard
      190
    3. 3
      Michael Scrip
      77
    4. 4
      PsYcHoKiLLa
      76
    5. 5
      Steven P.
      73
  • Tell a friend

    Love Neowin? Tell a friend!