Thread: C++ or C#?

  1. #1
    Registered User
    Join Date
    Apr 2014
    Location
    Hong Kong, Hong Kong
    Posts
    16

    Question C++ or C#?

    I am using Visual C++ or visual C#, which should I use?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    What kinds of programs are you interested in writing?

    Programming languages are tools (much like a hammer and saw are tools for a carpenter).
    Picking the right tool(s) for the job at hand is vital.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Apr 2014
    Location
    Hong Kong, Hong Kong
    Posts
    16
    I wanna make a game, but I'm making a calculator to start.

  4. #4
    SAMARAS std10093's Avatar
    Join Date
    Jan 2011
    Location
    Nice, France
    Posts
    2,694
    C++ I would say is the way to go then.
    Code - functions and small libraries I use


    It’s 2014 and I still use printf() for debugging.


    "Programs must be written for people to read, and only incidentally for machines to execute. " —Harold Abelson

  5. #5
    Registered User
    Join Date
    Apr 2014
    Location
    Hong Kong, Hong Kong
    Posts
    16
    Thanks, can anyone compare them?

  6. #6
    Registered User
    Join Date
    Nov 2012
    Posts
    1,393
    This question should be in a more general forum.

    C# runs in a virtual machine and mostly assumes prescence of a .NET framework. In practice it makes it easier to develop Windows applications, if that is your target.

    C++ compiles to native code and makes minimum assumptions about the underlying system. There is no built in GUI or graphics support, so to get those features you generally choose the libraries you want and add them to your project. In practice it probably takes more effort to get productive in C++ but once this effort is exerted you have more possibilities than in C#.

  7. #7
    Registered User
    Join Date
    Apr 2014
    Location
    Hong Kong, Hong Kong
    Posts
    16
    thx!

  8. #8
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Moved to General Discussions.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  9. #9
    Registered User MutantJohn's Avatar
    Join Date
    Feb 2013
    Posts
    2,665
    Hmmm.... This is a tough question to answer. I think C# is quicker and easier if you want to keep your applications more Windows friendly. This isn't to say that Unix-like systems won't be able to benefit from your code but I'm not sure how easy it is to port C# code between platforms.

    I've found something that might help though. Assuming you know C++ and C# well enough, this might help :

    C# for C++ Developers

    and

    C++ vs. C vs. C# - C++ Forum

    Edit : I'm someone that loooooves to focus on performance or optimizations so C++ is my favorite. Or at least, I try​ to focus on performance, ha ha.
    Last edited by MutantJohn; 04-27-2014 at 10:43 AM.

  10. #10
    Registered User
    Join Date
    Apr 2014
    Location
    Hong Kong, Hong Kong
    Posts
    16
    Dude, you guys are nicer than what i expected, I think there might be flamewars (I am ready for it)

  11. #11
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    Quote Originally Posted by MutantJohn View Post
    I'd tread carefully when reading those links.

    The first is clearly written by someone (or someones) who knows C# a lot better than they know C++. Some of the things stated to be "common" in C++ are considered really bad practice in C++.

    Although some posts in the second link are alright (people taking a balanced view in which C, C#, and C++ all have their place), most of the posters are writing to advocate one or other of the languages.

    As a general rule, it is a mistake to reason about any one of these languages based on experience in another. The languages are too different for that sort of thing to work well. A C# developer who knows a little bit of C and C++ is rarely a useful source of information about C or C++. That sort of statement cuts each way too.
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Buttercup, and read this, this, and this before posting again.

  12. #12
    Registered User
    Join Date
    Apr 2014
    Location
    Hong Kong, Hong Kong
    Posts
    16
    I've decided to go with C#, I can use it in Unity, I wanna learn unity, dude.

  13. #13
    Registered User MutantJohn's Avatar
    Join Date
    Feb 2013
    Posts
    2,665
    Bro, I'm so glad we helped you come to a solid conclusion, mang. Manger. Bro-tastic voyager, I wish you only the best of luck in your coding adventures!

  14. #14
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    2,158
    Quote Originally Posted by lolllol View Post
    I am using Visual C++ or visual C#, which should I use?
    Use C#, it's by far better.

    C# is bound to the garden of Microsoft, where things are kept nice and ordely for everyone's benefit. But C++ is on any random platform, it's freedom is bad. Like it would be for weed.
    C# uses a nice massive runtime, but C++'s runtime is pretty small and ubiquitous. So when your users don't see those dependencies they'll think it's not a very well supported program.
    C# is dynamic, so when things take a long time to happen, your users will know it's getting stuff done. But C++ is natively compiled so when things happen fast, your users will think it's not getting any real work done.
    C# is spontaneously garbage collected, so you can write code without caring about resources. In C++ you're encouraged to use predictable features like RAII, and when you have to consider everything your code is doing it hurts your productivity.
    Last edited by Yarin; 04-29-2014 at 10:27 AM.

  15. #15
    Registered User MutantJohn's Avatar
    Join Date
    Feb 2013
    Posts
    2,665
    That's facetiousness, right? Because right now I'm laughing so hard XD

Popular pages Recent additions subscribe to a feed