C++ vs C# - What Programmers Need to Know About Their Similarities and Differences

Поділитися
Вставка
  • Опубліковано 28 лис 2024

КОМЕНТАРІ • 337

  • @rohansampat1995
    @rohansampat1995 2 роки тому +64

    Wow this really goes over stuff really well. I want to point out the C# does actaully have a tiny amount of control over the GC as you can finalize things. Now this does not guarentee like... anything but you can finalize something and clean up resources in a "destructor" in C#. C# also supports pointers and memory management through unsafe code but no one should really be using it unless they are a niche exception.

  • @JLPT-AIsensei
    @JLPT-AIsensei Рік тому +39

    C# is the most beautiful language for me so that after 5 years of using it, I have no intent to switch to other languages.

    • @KaustavMajumder
      @KaustavMajumder 9 місяців тому +1

      Can you help me with one thing?
      A desktop application that I wrote in C sharp would work on my system. But would not work on many other computers using the same OS. How does one deploy a C Sharp application?

  • @McCulloughAssociates
    @McCulloughAssociates  2 роки тому +109

    I love the passion everyone has for their favorite language! Just as a bit of background, My first C++ project was in 1985 using CFront and my last was completed just a few weeks ago - a rather large application for the US military. C&C++ are my first loves as those were my first languages. I have built dozens of projects over the decades in C++, C#, and Java and I find all three to be quite capable and useful and enjoy all. I also have comprehensive training courses on all three platforms with thousands of students. Point is, I know and use all 3 and really have no preference. We left 30 minutes of video on the cutting room floor when making this, so we didn't cover every detail in this short video. Our goal wasn't to declare a winner, but to provide an answer to a very common question.

    • @ryanrivera9623
      @ryanrivera9623 2 роки тому +1

      I love how Java and C# are so similar. I learned to program in Java, and was able to pickup C# very quickly, and love working with both. I’ve only dabbled in C++ in my side Arduino/Raspberry Pi projects, but hope to become proficient using it in my spare time. Thanks for the great information!

    • @nguyenducminh4966
      @nguyenducminh4966 2 роки тому

      @@ryanrivera9623 I'm no expert but the reason why you could pick it up so fast was because of the same concept of the two languages: they both run on a virtual machine, one is JVM while another is CLR.

    • @gooniesfan7911
      @gooniesfan7911 Рік тому

      Hey what was your project for the US military

    • @redrevyol
      @redrevyol 9 місяців тому

      I've been a C# programmer for a few years, but I am switching to C++ because C++ can be portable and can be interfaced with other languages. Microsoft just can't provide tools that I want.

    • @erik9817
      @erik9817 8 місяців тому

      Thanks for the perspective. I have been struggling in deciding between C# for applications/backend and C++ for graphics rendering, maybe I will be fine with using both. But I feel I need to make a decision in order to facilitate efficient learning. I'm not a beginner but feel my progress is slowed by my tendency to jump between the two. Not sure if it is healthy.

  • @AlDunbar
    @AlDunbar 2 роки тому +33

    As an amateur musician, I hear C sharp and think: "isn't that the same as D flat?"

  • @dougwarner59
    @dougwarner59 2 роки тому +79

    personally, I though learning the programming rules for C++ was a easier than C#. But once I learned each language I found C# was a lot to use because of the reasons you mentioned.

  • @zacharychristy8928
    @zacharychristy8928 2 роки тому +20

    To your point about C++ being useful for games, that's mostly true! If you're building an engine, or making a game from scratch C++'s performance is practically essential. I've used C# far more often for games though, since it's supported by engines like Unity and Godot, and tools like LINQ and interfaces can help manage complex collections of objects and their interactions. I like my engines in C++, and my game code in C#.

    • @Erlisch1337
      @Erlisch1337 2 роки тому

      Depends on what kind of game/engine. If its its advanced/high performance 3D then yes I would go with C++. But if its just a 2D or basic 3D I would go with C# for the ease of use.

    • @LyricsQuest
      @LyricsQuest Рік тому

      Good point. C++ Game Engines can be multiplatform since they use multiplatform gui code, while the c# doesn't provide the GUI code so it can be used everywhere including linux (.NET GUI does not work properly in Linux, even with WINE... only if you're lucky). Portability and ease of use, that's a great combination.

    • @justadude8716
      @justadude8716 Рік тому +1

      Recently Godot finally made C# and their own language feature identical, making C# ever better choice for 2d games.

  • @JVApen
    @JVApen 2 роки тому +77

    As C++ programmer, I really like that it's represented in a correct way. That's really rare.

    • @BasPower12
      @BasPower12 Рік тому +4

      Yes, I agree as a C++ devoted learner it is often misunderstood and underrated and newer languages like Rust are being overrated.

  • @uni-byte
    @uni-byte 2 роки тому +8

    Any job these days is going to require C#, Java Script and Python. C++, while a superior language for sheer performance (in the right hands), does not lend itself well to the "average" code monkey. It's too easy for them to hang themselves with it. For that reason, it you have the honest ability to properly deal with C++ (and C) they are certainly nice to have on your resume and will probably allow to work your way into a higher paying job.

    • @toby9999
      @toby9999 2 місяці тому

      Not necessarily. I work for a multi-national software house, and we don't touch C#. Sadly for me, because C# is streets ahead of java for desktop application development. I hate java.

  • @rp8133
    @rp8133 2 роки тому +28

    I'm late in here. Thanks for this comparison. As a software developer working more than 2 decades with C++ and C# I can agree with your speech. Both languages are similar but do have subtle differences. As a guide I would suggest the following: For UI use C# and technologies that are best for the task. For near-hardware-work use C++. To close the gap between C# and C++ use C++/CLI. For implementing communication protocols use what ever you want - there are so many available...

    • @dharanibala8443
      @dharanibala8443 Рік тому

      Which language helps to understand computer better?

    • @DefaultGuy84
      @DefaultGuy84 Рік тому

      ​@@dharanibala8443C

    • @michalsvihla1403
      @michalsvihla1403 11 місяців тому

      @@dharanibala8443 When it comes to abstraction starting from most abstract: C# > C++ > C > Assembler > Binary

    • @brandyballoon
      @brandyballoon 9 місяців тому

      @@dharanibala8443 C

  • @Hcloud65
    @Hcloud65 2 роки тому +4

    I took C++ and VB in school and taught myself C#, I found that C# was easier to learn; its like C++ and VB had a baby. You get the power of C++ and the Graphical interface like VB all in one. I have been programming in C# for about 12 years now from game programming to databases and other apps at work.

  • @mahkhi7154
    @mahkhi7154 2 роки тому +23

    The question isn't Which to Learn, but Rather which to Learn First. Learn 1, you can Learn the Other in 30 days. I've never Learnt PHP, however since I know C/C++ and C#, I can easily understand PHP.
    The question, which First? C#. C# is like Visual Basic. It is forgiving if you make mistakes. After C#, you can learn C/C++. You'll have to learn a little extra to see how it works at a lower level, closer to the hardware.

    • @annekedebruyn7797
      @annekedebruyn7797 2 роки тому +1

      I learned Visualbasic back in highschool. Never used it. So going with C# was a good place to start for me.
      It doesn't have to be identical. But if certain things crossover it makes the much less frustrating.
      While I haven't touched C(++) I can see how that would be the same for that language and C#.

    • @sbypasser819
      @sbypasser819 2 роки тому +1

      what if im in highschool , i cant learn a language in 30days. So i learn c++ because it runs on android and c# doesnt. And i want to program for android.

    • @annekedebruyn7797
      @annekedebruyn7797 2 роки тому +2

      @@sbypasser819 c# can be used for android and IOS apps even. Might not do what you want to do. But C# is multi platform. Check out Xamarin for Android specifically.
      But ultimately you want to learn C++ anyway so I'd say, if you are willing to start with that and you are still in high school. Please stay with C++. Especially if you want to do computer science at university later on.

    • @CallousCoder
      @CallousCoder 2 роки тому +1

      True and the answer is assembly. I still build upon those 6502 days. And I still can relate performance issues back because of that understanding of assembly - although with x64 it’s not as trivial with that terrible extensive opcodes set.

    • @Kenbomp
      @Kenbomp 2 роки тому

      You can learn syntax of c# in 30 days but it will take years to learn the vast library it has. C++ your more on your own. Good or bad

  • @OperationDarkside
    @OperationDarkside 2 роки тому +7

    I startet with C# because of my employer, but soon got hooked on the performance C++ offered. Some C# frameworks were terribly slow back then. Especially .NET Entity Framework. Almost all private projects are C++ now except where I'm forced to use other languages. The only thing I really miss are human readable compiler errors. Especially template-related error messages can be almost unreadable.

    • @swapode
      @swapode 2 роки тому +3

      You might really enjoy Rust.

    • @michalsvihla1403
      @michalsvihla1403 11 місяців тому

      What compiler do you use?

  • @Larry821
    @Larry821 2 роки тому +9

    This was interesting. But I think which language to learn depends more on 1) the OS environment you are tasked with developing apps for, 2) why you are learning the language, and 3) what you hope to do with it.
    In the Linux world you are traditionally developing in C/C++ (or a higher level language) not C#, though that is at least possible now. In the Windows world, at least in the case of apps, C++ is rarely used anymore and the scale tips mightily to C#.
    Professional programmers will tend to want to learn those languages they enjoy and bring them the best market opportunities. Companies will tend to develop in the languages which make their IT staff most productive. On both these counts I think C# is vastly superior, at least in the Windows world, which, after all is the environment it was created for.

    • @justadude8716
      @justadude8716 Рік тому

      For developing and shipping a product c# is the clear winner unless your application dictates you use c++

  • @amitzohar3107
    @amitzohar3107 3 роки тому +26

    very good comparison. regarding the line "Programmer has no control over GC", while that's mostly true,
    the programmer can force the garbage collector to run by calling GC.Collect().

    • @McCulloughAssociates
      @McCulloughAssociates  3 роки тому +20

      True and .net provides better control than Java. I wouldn’t recommend explicit gc except in very unusual circumstances.

    • @amitzohar3107
      @amitzohar3107 3 роки тому +7

      ​ @McCullough & Associates yea it's not recommended but it's still used in cases where the programmer did some action that caused a lot of memory to be unused and unreachable and he wants the GC to free those memory allocations from the RAM at that point, so he calls GC.Collect() and after those memory allocations are freed the app will consume less memory and run faster since the GC, which freezes all threads (except for Gen2 collection when Background GC is performed) to check all memory allocations and free unreachable ones, will have much less memory allocations to review, thus the app's threads will be frozen for a shorter time, thus the app will run faster.

    • @Cara.314
      @Cara.314 2 роки тому +1

      the best control you have over GC is structuring things to not need it very much. dont do mindless allocations of stuff, make good use of value types, so on, so forth. There's all sorts of stuff in c# that enables you to work around the GC, just look into the fixed keyword as 1 example.

  • @johnshaw6702
    @johnshaw6702 5 місяців тому +1

    Interesting, and a good explanation. I've prgramed in both C++ and C#, and have found myself frustrsted at times with C#. I've ran into a few situations were what would be simple in C++ was not possible in C#.
    Example: I had to modify an external library to do something that actually requied me to create a thread in it. The thread needed to finish its job before any application using it shutdown or the data would be lost. In C++ the thread would have to complete its job before it would stop processing. In C# the thread would just stop, regardless of its state at the time. Every mechanism, on paper, that was supposed to allow me some control over the thread in C# was bypast completely.

  • @IamusTheFox
    @IamusTheFox 2 роки тому +6

    Extremely well done. From my admittedly short experience with C#, I find it gives you a ton of tools to do everything. C++ gives you the machinery to make the tools. Sure C++ doesn't have a webapi out of the box, but you can make more meaningful abstractions with C++ than C#.
    That, and C# is a OO language first and C++ is exactly as OO as it is functional.

  • @RandomDude00001
    @RandomDude00001 Рік тому +4

    I learned C# first since it was the language Unity using which I use for making my games.

  • @MrAbrazildo
    @MrAbrazildo 2 роки тому +14

    4:20, C++ hasn't the interface keyword, but has virtual, override, final and '= 0' for the 1st f() in an "interface". It has also the slowness that only an interface can provide. For strongly typed as parameters and returning, it's pretty easy to code them by yourself.
    5:50, oh, my! You didn't mention the containers C++ has in its standard library, all of them managing automatically their own memory, making memory leakings a challenge. And for raw pointers, there's always the option to wrap them into a class, making your own smartpointer, if this last 1 was not an option itself.

    • @raymundhofmann7661
      @raymundhofmann7661 2 роки тому +2

      He looked like a Microsoft c# garbage (collected) language shill to me anyway. Managed languages are for soydevs giving us the climate doom by bloating up memory use and draining all batteries with excessive CPU load.

    • @مقاطعمترجمة-ش8ث
      @مقاطعمترجمة-ش8ث 2 роки тому +1

      @@raymundhofmann7661 Lol that was my exact thought on C#, fun fact that many famous desktop/Windows application were written in C++, as IT and intensive Windows user over 22 years I can tell from first look at the program, if it's running solid C++ or crappy C# .

  • @manuprakash8456
    @manuprakash8456 2 роки тому +3

    I liked this video and agree to most of the facts stated. This was what I was looking for. I would like to add a few things about c++. C++ covers really wide range of hardware--ranging from 8-bit microcontoller to 64-bit intel architecture. I would recommend undergrads to go though c++ concepts atleast once to understand how C++ rides the horse (hardware.) Once you are through C++ you would intutively understand how C# is working. I, myself, started from assembly language then C & C++ to-and-fro then c#. All because of the type of applications that I was developing.

  • @simonfarre4907
    @simonfarre4907 2 роки тому +32

    If you learn C++, learning C# will be a walk in the park. That is why I *always* tell people who have a talent for programming or a passion, go for it. Learn C and C++. Literally every single language after it, you will pick up in a week or two.

    • @kuchukboromdebbarma2117
      @kuchukboromdebbarma2117 2 роки тому +4

      Not really
      Language like elixir requires its own set of mindset

    • @simonfarre4907
      @simonfarre4907 2 роки тому +11

      @@kuchukboromdebbarma2117 functional programming languages does require some added study, but I would argue that has less to do with programming work in practice and more to do with the theoretical. Functional programming places an artificial constraint on what you can do (or should do) and doesn't map particularly well to how computers actually work.

    • @nontraditionaltech2073
      @nontraditionaltech2073 2 роки тому +3

      The hardest part of learning C# (as a former C developer myself) is learning all the damn libraries needed for my day job

    • @andresvallelisboa5511
      @andresvallelisboa5511 2 роки тому +2

      @@nontraditionaltech2073 You have google and microsoft docs for that.

    • @nontraditionaltech2073
      @nontraditionaltech2073 2 роки тому +1

      @@andresvallelisboa5511 all day, every day lol

  • @adam7802
    @adam7802 Рік тому +3

    Currently my tech stack is only web based things but I've really wanted to dig deep into other languages and working with the hardware more directly, been trying to learn C using GBDK (a library for writing gameboy games) which has been a huge be very fun learning curve! I've also been interested in learning C# just for job opportunities really, since I think I can probably pick that up faster and it seems to more there is a variety of work you can do with it. Even though I'm not looking at C++, I'm going down a bit of a rabbit hole of information here and absolutely loving it, really enjoyed the video.

  • @NZRanger
    @NZRanger 2 роки тому +2

    When working out what tools to use, use the tools that are right for the job! If you want RAD on a PC platform then don't shy away from learning Pascal and use Lazarus/Delphi which allows RAD for everything from Windows to Raspberry Pi. I've been coding for over 30 years and have certifications in languages like C++/C#/Java but I'll use the best tool for the task at hand. It's sad that such great languages like Pascal/Delphi fell off the radar due in general to pi$$ing competitions.

  • @denielalain5701
    @denielalain5701 2 роки тому +1

    Hi!
    6:01 - In seashark there is no way to alter garbage collection indeed, however ~destructors are worth mentioning.

  • @KhaosEmeraldx
    @KhaosEmeraldx 2 роки тому +2

    I really need to wrap my head around C++ better. I’m a game dev with experience in C# and whilst I love it I really feel like there is an upper limit to the efficiency so I am trying to learn the other side. Pointers and garbage collection are the two bits I get really lost on!

    • @MariusSchwendtmayer
      @MariusSchwendtmayer 6 місяців тому

      I wrote a custom memory pool system in C# that uses unmanaged memory.
      Leading to me using only structs, field offsets and fix pinned buffers for every game...
      C++ is still faster even using virtual/abstract classes.
      You will not regret it.

  • @lewessays
    @lewessays 2 роки тому +1

    Sadly I failed my C++ class. I don't really recommend C/C++ as a first language. I recommend a higher level language then going on to lower level languages. I am now doing well in C and C++. I don't love them like Python or Go or Kotlin, But, the knowledge you get from learning these lower level languages is just addictive and makes you love and appreciate computers on a deeper level.

  • @marna_li
    @marna_li 2 роки тому +3

    About generics. In C++, templates are macros run by the preprocessor before compiling code - it generates code for each occurrence. In C#, generics is a feature of the runtime with runtime representation. On the other hand, Java uses type erasure, which is more like in C++. So no runtime info about generic types.
    A generic type (class or struct) is either open (has placeholders - List, cannot be instantiated) or closed (has parameters set - List or List). In the case of parameters being reference types, it just have to generate one runtime representation of a closed type at runtime and reuse if for all reference types - since it handles parameters that are references with a fixed address of the same size for every type.
    When it comes to value types you pass the "value" as a parameter, different sizes depending on struct, and thus the runtime generates a new generic type for every variant.

    • @tomahawk5357
      @tomahawk5357 2 роки тому +1

      In C# generics are resolved at compile time, not at runtime.

    • @au._.79
      @au._.79 2 роки тому +1

      C++ templates are not macros and not run by preprocessor neither, but they act like "macro" but it has sense of language grammars rather than just text replacement.

    • @marna_li
      @marna_li 2 роки тому

      @@tomahawk5357 Generic type definitions are part of the metadata - as a ”template. Of course, the compiler is aware of the types.
      But the actual instantiation of a ”closed” generic class or method is at runtime with it in memory.
      As I tried to say before, the runtime, and subsequently the JIT compiler, creates versions optimized based on the type arguments.

    • @tomahawk5357
      @tomahawk5357 2 роки тому +1

      @@marna_li Generics are resolved at compile time in C#. There is nothing in particular when instantiating a object from a generic class as everything is created at compile time and not at runtime. Once again, generic types are resolved at compile time not at runtime. Speaking about metadata is another subject....

    • @alphaanar2651
      @alphaanar2651 2 роки тому +2

      Mate, you are wrong, in C# generics pretty much work the same way as C++, compiler generates code for each occurrence, as you said for C++. So it is really not a runtime thing

  • @L1ghtOn3
    @L1ghtOn3 2 роки тому +4

    Really love C# after doing some android in Java then done games on Unity fell in love with C# as it just felt so similar but an easier C++. I use C++/Blueprints on UE4/5 but still prefer C# even though for FPS and realism especially UE5 is the way to go until Unity catches up, don't know why but the remote 5 not working for testing with the new starter assets and UI has hit some indie devs hard in the pocket the last few years since 2019.3. I was an avid Unity supporter until recent but I'm switching to UE5 full time now as Unity has let me and many others down chasing high end graphics and other unnecessary non indie developments. I will miss C# but still might use it for .net web/UWP/MAUI etc in future and if Unity gets the finger out and gets everything working again in support of indie devs I might have another look in a few years but never thought I'd leave Unity but they forced my hand waiting over 2 years just to do simple testing in real time, just not good enough for large 3D android games that take an hr to build just to test. Nope, so looking forward continuing my C++/Blueprints journey 👍

  • @QuikRay
    @QuikRay 10 місяців тому +1

    Both compilers/interpreters were written and are maintained by Microsoft. C# and C++ were written for different purposes, but each can be used to accomplish a given task. Why then did MS come up with a new language called C#??? What was the motivation behind that endeavor??? Can you answer that, objectively????

    • @McCulloughAssociates
      @McCulloughAssociates  10 місяців тому +1

      MS didn't invent C++. I was a product of Bell Labs (AT&T) and Bjarne Stroustrup in the early 1980s. Many companies, including MS have developed C++ compilers. As you mentioned in the question, C++ & C# are good for different purposes. C# was an ongoing effort involving VB and the untimely divorce of Sun (Java) and MS.
      C# and the .Net platform are primarily intended for general purpose application development including desktop and web. C++, also general purpose is better at high performance applications, but not really web.

  • @SakraIgor0qNomoko
    @SakraIgor0qNomoko 2 роки тому +12

    As a non-programmer, I think someone would have to already know one of the languages (or have taken college classes) to understand most of the terminology you use. Perhaps explaining jargon a bit more would lead to a wider audience appeal.

    • @chillydill4703
      @chillydill4703 2 роки тому +4

      Well, what you are referring to is basic understanding of programming in general, regardless what language it is (python, java, javascript etc..).

    • @vortex_7574
      @vortex_7574 2 роки тому +2

      @@chillydill4703 Agree. My first language was python in college and moving to C++ was seamless. The same went for C# and Java. Mostly the terms changed but the concept was really similar between all.

    • @chillydill4703
      @chillydill4703 2 роки тому +1

      @@vortex_7574 Yep agree!

    • @broquietstorm1266
      @broquietstorm1266 2 роки тому

      @@chillydill4703 The question is though, is this video for you guys or is it for someone like the OP? I'm asking because I have no idea and feel the same as the OP.

    • @chillydill4703
      @chillydill4703 2 роки тому

      @@broquietstorm1266 Well, personally, I think it's for a beginner turning into an intermediate programmer who already knows the fundamentals of programming but started to explore where improvements could be done, hence looking into these languages.

  • @FromBeaverton
    @FromBeaverton 2 роки тому +2

    Good explanation, except horrible mess with templates vs. generics. In C++ templates invariant is generated during compiling time. If it is missing, code would not link. You cannot run library with template class against some new type, because at runtime it is already too late. C#, on the other hand, also generates invariant, but at runtime. As a result, you can instantiate and execute generic class against a new type. If would be nice if this video would mention this huge difference.

  • @tek1645
    @tek1645 2 роки тому +25

    I started with C++ during high school 😂 Then I did C# for fun and enjoyed it more

    • @Stabruder
      @Stabruder 2 роки тому

      Me too

    • @lewessays
      @lewessays 2 роки тому +2

      Sadly I failed my C++ class. I don't really recommend C/C++ as a first language. I recommend a higher level language then going on to lower level languages. I am now doing well in C and C++. I don't love them like Python or Go or Kotlin, But, the knowledge you get from learning this lower level languages is just addictive and makes you love and appreciate computers on a deeper level.

  • @hstrinzel
    @hstrinzel 2 роки тому +1

    Seems to me that C# is VERY similar to Visual FoxPRO, the language I know and love: An Object-Oriented language that is compiled into some intermediate code that kind-of interpreted with a Runtime Library. Easy to learn, very rich language designed to create interactive user-interface things in Windows and the Web and with the addition of the Record type they are getting closer to the data-centric model in Visual FoxPRO. With West Wind Web Connection for FoxPRO developing Internet Databases is a dream, and I can certainly see that I am NO missing much with C++ and C.

  • @brownrhythms
    @brownrhythms 9 місяців тому +1

    I spent sometime converting a C++ CLI service over to C#. In terms of syntax, I'll take C# over C++ CLI every time.

  • @desarrollou71x72
    @desarrollou71x72 2 роки тому +5

    I started with Basic from my old Atari 800XL.. then moved to Python... then C# and now C++... iḿ pretty sure will not move anymore.. i use Unreal Engine, Qt Framework, SFML and really happy with C++.....

  • @michaelshollaj6428
    @michaelshollaj6428 2 роки тому +6

    I've been programming in C# for long time, so I choose C#, both are amazing, but for my opinion C# is the best!!!

  • @FueRent
    @FueRent 2 роки тому +1

    you have quite a good control over GC, it just makes no sense, and afair doesn't work in debug where you would typically want to play with it.

  • @СергейЖданов-э5р
    @СергейЖданов-э5р 11 місяців тому +1

    Actually you can force GC to collect earlier if you need in C#

  • @Ash_18037
    @Ash_18037 2 роки тому +5

    3:04 You have completely missed the critical part about the CLR. Yes the C# compiler creates a DLL/EXE (assembly) containing IL code. However the CLR does not actually run IL at all. Instead when a .NET DLL/EXE is first executed the CLR performs Just in Time (JIT) compilation of the IL to machine code and caches that machine code on your computer. It is this machine code that executes. The compilation to machine code is why .NET assemblies are sometimes slower to start up the first time. But from then unless you recompile your c# code, when you run that EXE/DLL it is just the existing machine code file that is being executed.
    In general machine code execution C# is a only slower than C++ because of the overhead of auto memory management and numerous bounds and other 'safety' checks it adds to the generated machine code. However, because the CLR is platform aware, when JIT compiling it is able to apply various platform specific optimizations to that generated machine code and so performance is improved over standard cross platform generated machine code.
    If you've worked with C# for some time you really need to understand this. If you're more a C++ dev . fair enough. it is not obvious unless you dig deeper which is why so many are confused.
    By the way, it is "intermediate language code" in the dll/exe, NOT "intermediate machine code". In context with what I explain above this is extremely confusing for new people. Please don't call it that. See: docs.microsoft.com/en-us/dotnet/standard/managed-code

    • @bobweiram6321
      @bobweiram6321 2 роки тому +2

      C# also compiles to native instructions or AOT.

    • @McCulloughAssociates
      @McCulloughAssociates  2 роки тому +3

      You are totally correct. We didn't want to dive that deep in a short presentation.

    • @matt-xq1xv
      @matt-xq1xv 2 роки тому

      Very well put

    • @clonkex
      @clonkex Рік тому

      I wish people would emphasise this point more. It's really important to know that C# isn't running in a VM, it runs natively, the same as C++. I see tonnes of C++ devs pile on hate for C# because they mistakenly believe it runs in a VM.

  • @henrykkaufman1488
    @henrykkaufman1488 2 роки тому +2

    Id say its easier for any programmer to be successful if he knows about memory and how code is executed. After all, that is what is actually being programmed. Its easier to see a straightforward way to implement stuff if you know this.

  • @CallousCoder
    @CallousCoder 2 роки тому +7

    C++ I want lean binaries without , no runtime environments and that’s truly cross platform. C++ with Qt is a golden combo.

    • @dotnetforever
      @dotnetforever 2 роки тому +3

      no... at all. Qt is a golden disaster.

    • @CallousCoder
      @CallousCoder 2 роки тому

      @@dotnetforever why? I adore it. It’s very clear, intuitive and fast. And literally just create a project for that platform and it compiles and runs. That’s pure magic.

    • @YRBYD
      @YRBYD 2 роки тому +2

      I wouldn't call it very clear and intuitive tho. Imgui takes the spot for me in this category

    • @CallousCoder
      @CallousCoder 2 роки тому +1

      @@YRBYD ImGui is only a very simply UI library. Qt is a whole cross platform library, UI is a part of it you can’t compare the two. Qt it’s image processing and 3D abilities are stellar; I used it on Dunkirk and it could do everything out of the box we wanted. Very astonishing!
      And it’s QSockets make for a truly cross platform socket implementation which otherwise becomes a #ifndef hell.
      Stuff ImGui can’t do. If you just need a UI (albeit one that’s not using native OS components) ImGui will do the trick.

  • @trickysoft
    @trickysoft 2 роки тому +3

    After 40 years of C and 25 of C++ (no C#) the choice for me is a little wider. Including C which on several large projects, I have seriously thought about using and basic C++.
    I have often worked with very experienced C or VHDL/Verilog programmes who struggle with C++ and have no idea about C#. They can usually transition to the very basics of C++ but get on much better with malloc/free than they do with new/delete and cannot comprehend auto or smart_ptr. It is the hiding of what is going to happen that they usually struggle with and so operator overloading is also a no no except sometimes if it is a straight forward maths type.
    I would also say that for a simple small app with a short runtime, it doesn't matter.
    One other think to remember is how much effort is it to deploy whatever runtime is required for the final executable.

    • @OperationDarkside
      @OperationDarkside 2 роки тому +1

      For a second I thought you'd have to have 65 years of programming experience then. Even if you started at the age of 10 you'd be 75 now 😆

    • @trickysoft
      @trickysoft 2 роки тому

      @@OperationDarkside Sorry, I should have been more precise, yes, I use C++ much more than C, so it is more like 15 years of C before swapping mostly to C++ for the next 25 years but still doing some debugging and a bit of C coding, well, it has all been pre C99 as I've used VS since it came out.
      I really used to hate it when I would get a CV from a fresh grad claiming 3 years of C, 3 of C++, 3 of Java ...

    • @OperationDarkside
      @OperationDarkside 2 роки тому +1

      @@trickysoft It's all good :-)
      I have autism, so I take things very literally quite often. This sometimes leads to hilarious misunderstandings.

  • @krish3d385
    @krish3d385 2 роки тому +5

    I started learning c++ cause i had to, i loved its power, its inspiring i had the full control and understanding. But the job can be done way more easier in java or c# and they were too easy. Eventually i liked the coding part in every language. Its fun.

  • @tullochgorum6323
    @tullochgorum6323 Рік тому +1

    It's not accurate to say that C# offers no control over the GC - there are 8 different methods on offer from C# 10. Plus in many performance critical scenarios it is possible to write allocation-free code. HIghly optimised C# can approach C++ for performance while being safer and easier to write - though obviously managed code can never compete on memory use for embedded applications - that's simply not what it's designed for.

  • @MrAbrazildo
    @MrAbrazildo 2 роки тому

    7:50, it's good to mention that lambda in C++ is just a f() inside another. It can be used as a "functor", as well as just a scope, to be used 1 or more times, granting that all variables created there will disappear once lambda returns.
    Overall, to active a f() you just need its address, which can be provided by the name of the f(), a pointer to it and a provided bind by STL. Hence, the name of a f() can be used as a functor too. Unfortunately, you can't force a integer value to be interpreted as a f() address, and vice-versa.
    7:58, and multiple derived too.
    9:25, it has an explicit syntax for interface. 1 can see some member-f() be declared as:
    virtual fname (its parameters) = 0;
    Meaning that linker should not report an error if it can't see the f() definition.

    • @McCulloughAssociates
      @McCulloughAssociates  2 роки тому

      Thanks for your comments. We could have spent an hour digging into the details!

  • @TheBuilder
    @TheBuilder 2 роки тому +1

    do one comparing C# and F#

  • @lukafox7907
    @lukafox7907 4 місяці тому

    Can you do a comparison between C; C++; Rust; Zig; and an assembly -- which is faster?

  • @kamertonaudiophileplayer847
    @kamertonaudiophileplayer847 2 роки тому +2

    I would compare C# and Java. Why? You pointed that, C# as Java using JIT compiler.

  • @the_bogeyman.
    @the_bogeyman. Рік тому +2

    I will start a basic programming course next year and I need to choose either C++ or C# (and get the specific text book that goes with it), but I am still confused on which one to chose.
    I have no previous code experience, and my long term plans are try to get into IT and network positions where I work. Python is also something I should try start to learn too and maybe dig into Cisco stuff (but their courses other than expensive are not beginner friendly either). I understeand that the stuff to know in IT is infinite...but I gotta start somewhere. I've already done courses "similar"ish to the US Comptia A+ but I wish I started earlier 20 years ago.
    Thnx for any advice.

  • @miansherry6453
    @miansherry6453 2 роки тому +2

    Good thumbnail, good explanation.....

  • @oracleoftroy
    @oracleoftroy 2 роки тому +2

    Focusing on memory management misses things a bit. Thinking in terms of resources is more telling. A resource are things that follow an "acquire" and "release" pattern, e.g. a file is "opened" and "closed", a mutex is "locked" and "unlocked", memory is "allocated" and "freed", etc.
    In C#, the only resource you get automatic cleanup for is memory (through the GC), everything else you have to manually clean up. Using statements help with that, but that is something you have to explicitly remember to use every time you use a resource type. The GC doesn't help with anything else except as a failsafe that you never actually want to rely on.
    In C++, all resources can be fully automated so that they are always properly cleaned up, not just memory. Doesn't matter if it is a file, socket, transaction, mutex lock, or anything else, when you hit the end of its scope it is automatically cleaned up.
    C# uses old and busted 1960's GC tech, C++ uses modern 1980's tech with automatic resource management.

    • @rallolollo9309
      @rallolollo9309 2 роки тому

      in c++ the automated resource management is a desing pattern.... you have to do everything by yourself also c# has changed the gc very reacently and it's much better

    • @oracleoftroy
      @oracleoftroy 2 роки тому

      @@rallolollo9309 The difference is that in C++, you write your destructor once and it works everywhere. In C#, you implement IDisposable once, but you also still have to explicitly use that interface everywhere you handle a resource. Otherwise you leak the resource and have to hope the garbage collector finalizes it in a timely manner. Relying on the finalizer for cleanup is very bad and can be the source of a lot of slowdown with the GC. A properly written Dispose will suppress finalization on the object to avoid the extra overhead.
      Calling resource cleanup a design pattern is fine, but what that pattern gives you is the key difference. The C# Dispose pattern still requires manual resource management. The C++ rule of five/rule of zero pattern gives you automatic resource management, and does so transitively so that there is zero extra work once the destructor is written.

    • @rallolollo9309
      @rallolollo9309 2 роки тому

      @@oracleoftroy yhea but my point stands true, you still have to apply to that pattern everywhere, if you forget to do it you are causing serious problems. instead in c# you can let everything to the gc. My point is not as much as "how much code" do i have to write but instead will someone that never worked on c like languages mess up or not. For example if i would have to choose nowadays between c++ and rust i would probably go for rust for the same reason.

  • @fireteamomega2343
    @fireteamomega2343 2 роки тому +2

    It seems with the meta data and the compilation of c# it would be a security issue as it would be possible to reverse engineer the source code from a compiled state ? I know using c++ there have been times when that might be convenient especially with devices running a program and you may either have lost or simply don't have access to the original code. But I would imagine in a proprietary business model you probably wouldn't want that.

    • @McCulloughAssociates
      @McCulloughAssociates  2 роки тому +1

      Any program can be "de-compiled" regardless of the source language. Apps containing intellectual property or other secrets is at risk if it is accessible. It requires a more capable skillset to do that with C++ as it is more non-deterministic due to optimization and lack of symbols. But make no mistake, a hacker with your binaries can and will reverse engineer it regardless of the source language.
      C# decompiles readily into similar source code, however C# is optimized somewhat at compile time. Java, on the other hand, is optimized only at runtime, making decompilation much more deterministic.
      At best maybe some security through obscurity (which ultimately means no security).
      Games in the pre-internet era, written in assembly or C utilized an intentional manufacturing defect on the source CD as a sort of anti-piracy. The code often times tried to obscure the check by dynamically overwriting the code in memory then executing it to verify the disk error. A skilled developer could find the instruction and bypass the check in just a matter of minutes.

  • @marna_li
    @marna_li 2 роки тому

    Record types are data classes generated by the compiler that are immutable. By default, they are classes and passed by reference. There is also a struct equivalent in "record struct". Yes, they are great for defining data transfer objects. Thanks to their syntax with primary constructors.

  • @marna_li
    @marna_li 2 роки тому +5

    In C# everything is an object (with methods and properties), even the value types are - though they get copied when passed around and used as parameters. You can create pointers to value types in an "unsafe" context. System.ValueType, which is the base class of all structs (including primitive types) and enums, inherits from System.Object.

    • @ToadieBog
      @ToadieBog 2 роки тому

      Just some clarification, when reference types are passed as parameters, the objects they reference aren't copied, just the references to the objects.

    • @alphaanar2651
      @alphaanar2651 2 роки тому +1

      > In C# everything is an object-
      Pointers themselves are not objects

  • @fnamelname9077
    @fnamelname9077 2 роки тому +3

    This is a really great video.
    I'm happy to report, however, in 2022, inline-declarations are starting to make header-only libraries popular. A lot of projects don't have or need separate implementation files (except, perhaps, for a single one), because of emerging initialization guarantees.

  • @lionlinux
    @lionlinux 2 роки тому +2

    Looks like commertial for c sharp

  • @Aisaaax
    @Aisaaax 2 роки тому

    The way I look at it is there is really nothing you can do with c# that you cant do with c++. But there are things that you can do with cpp that you cant do as well wth cs.
    It doesnt mean that c++ is always better. There are a lot of projects where saving 1ms of speed is completely irrelevant, so you there will be no tangible benefit to c++ over c#.
    It is a question of whether the developer's time is more valuable than execution time. And sometimes the answer is yes.

    • @wopmf4345FxFDxdGaa20
      @wopmf4345FxFDxdGaa20 2 роки тому

      Exactly, good points. It's a question about at which language you are most effective working at and there it also depends about what kind of problem you are solving and what libraries, etc. you have available for that problem in each language. Like a carpenter doesn't do everything with a screwrider when building a house. Instead he uses different tools for different jobs, he uses saw and hammer and etc. In programming there often comes up this not very sensible idea that everything should be done with one language.

  • @lionlinux
    @lionlinux 2 роки тому +2

    I've started learning c# only after crossplatform version of dot net was populated!!!

  • @mr.shredder5430
    @mr.shredder5430 Рік тому +1

    make a video about your favorite c++ framework

  • @software2171
    @software2171 2 роки тому +5

    Missing : C# easily reverse engineered and get the source code back but not C++(CLI)

    • @Cara.314
      @Cara.314 2 роки тому +4

      it was not missed. covered about half way in.

    • @Erlisch1337
      @Erlisch1337 2 роки тому

      watch the video next time

  • @seanknight9808
    @seanknight9808 2 роки тому

    So, if I had to choose one to learn, which would it be? What is used more nowadays? Which one is in higher demand? Are they about the same? I heard Python is the most important language nowadays.

    • @Blaisem
      @Blaisem 2 роки тому +1

      In the programming world, people emphasize the slogan "the right tool for the job." This means there is **no** swiss-army programming language that does everything. When you ask for "the one" language to learn, then you are inherently opting into a trade off where you will be most marketable for what that single language provides and not top tier in other contexts.
      In short, any major language is viable. You can pick one and learn it and get a job. What you may want to ask instead is "which language is the most important for the work _I_ want to be doing?"
      Ergo, the hard part is actually on you. _You_ need to figure out what it is that you wish to do. After that, a simple Google search will tell you which language is best. What you are trying to do here is ask us what we think you want to do. Obviously, this approach isn't objectively reliable, unless you want superficial reassurances to comfort your indecision.

  • @elenfoiro78
    @elenfoiro78 2 роки тому

    A few inaccuracies in the presentation of C++ which I believe comes from a lack of practice. For example, the value vs the reference thing only demonstrate poor understanding of what's really going on under the hood. So interesting video if you're looking for a wrap up of the myths and urban legends about C++.

    • @ZeroSpawn
      @ZeroSpawn 2 роки тому

      Nice complaint, but lacking solutions.

  • @juergenm6107
    @juergenm6107 2 роки тому +3

    Good comparison. But at the end it is like comparing apple with pear. You comparing the STL with the whole dotNet Framework.
    In reality when we take the cross platform capability then there will be no GUI Framework in the dotNet world.
    For GUI and other missing stuff in the C++ world, you can add e.g. the Qt Framework which has many features you mentioned on the dotNet side.
    But in the end such comparisons are not very use full. It always depends on the problem you like to solve and which resources you have available.

    • @Ormaaj
      @Ormaaj 2 роки тому

      The GUI issue will be solved eventually I think. It isn't a fundamental limitation of dotnet, there's just been a lack of interest in solving some fundamentals correctly. QtSharp's technique for emulating name mangled object code is about the best hack for the moment. It's a symptom of a deeper problem Microsoft has been trying and failing to solve for the last 30 years, because their basic approach is always the same - wrap C++ in an IDL type intermediary like DCOM / CORBA. IDLs are interesting but there's zero interest in building on that in the open source world. I don't think the C++/CLI approach is the right one either. Microsoft was not ambitious enough in building out meta-programming facilities with Roslyn so it fell way short of what it could have been. That's ultimately why you have no GUI, and no successful dotnet ports of mainstream languages.

  • @shekcbanny
    @shekcbanny 2 роки тому +3

    C# job market wide.

  • @aaronpizarro4216
    @aaronpizarro4216 Рік тому

    In which language would you reccomend to start? I would like to start my journey in programming with one of this languages

    • @McCulloughAssociates
      @McCulloughAssociates  Рік тому

      Learn all of them! ;D Seriously - it really doesn't matter - maybe your job prospects would dictate the starting point. Programming is much, much more that language. The more languages you are fluent in, the better software engineer you will be in all of them. (plus, languages come and go)

  • @istvanszennai5209
    @istvanszennai5209 2 роки тому

    7:24 uhm..functional programming is something totally different (C++ and C# are imperative languages). Of course you could say that since C++ template metaprogramming is Turing-complete, you can in fact use templates to write functional programs, but they will be "executed" by the compiler.

    • @McCulloughAssociates
      @McCulloughAssociates  2 роки тому

      Agreed C++/C#/Java are not primarily functional. However, the ability to treat a function as an object is an important tool in realizing dependency inversion.

  • @BasPower12
    @BasPower12 Рік тому +1

    C++ better than C# in performance and all other tasks except backend web

  • @bobweiram6321
    @bobweiram6321 2 роки тому +5

    C# is a highly productive, versatile and joy to program in, but it is despised because it's Microsoft. C# can also be compiled (AOT) on all platforms.

    • @tordjarv3802
      @tordjarv3802 2 роки тому

      While it is true that you can compile C# programs for non-M$ platforms, it is generally a terrible experience and you are limited to older versions of C#. If you don't want to develop for M$ platforms (i.e. Windows and XBox) I would suggest not using C#, personally I would suggest Kotlin as a good alternative to C#.

    • @McCulloughAssociates
      @McCulloughAssociates  2 роки тому +6

      .Net Core (modern c#) is run-anywhere. And if you consider Xamerin or Maui, you can cross compile for android and IOS.

    • @Aidiakapi
      @Aidiakapi 2 роки тому +5

      C# is consistently rated as one of the most loved languages out there, so calling it despised is a bit excessive.

    • @Aidiakapi
      @Aidiakapi 2 роки тому

      @@tordjarv3802 The headaches you have running JVM based code everywhere isn't too dissimilar from running .NET based code everywhere.
      In the end, they're both rather easy to run cross platform nowadays, but each have their flaws.

    • @tordjarv3802
      @tordjarv3802 2 роки тому

      @@Aidiakapi Who calls C# despised?

  • @MrEW1985
    @MrEW1985 2 роки тому +1

    First C# and then C++ is the good answer

  • @weskerend507
    @weskerend507 Рік тому +1

    What an amazing video, straight to the point and very informative, thank you!

  • @magburner
    @magburner 2 роки тому +6

    An inexperience programmer can tell you this. C++ is cloers to C in its nature. C# is closer to Java in its nature. The only thing both programming languages have in common is the letter C.

    • @Cara.314
      @Cara.314 2 роки тому +1

      all 4 share a similar syntax. c# also has a considerable subset of features that bring it closer to c than java.

  • @clonkex
    @clonkex Рік тому

    3:10 No! This isn't true, and it's an important distinction and a common misconception (especially among C++ programmers, for some reason). C# compiles to native machine code, exactly the same as C++. The only difference is that it does it at runtime using the CLR's JIT compiler. There's no VM involved. All C# code runs directly on the hardware, exactly like C++. It just has extra hooks to trigger the compiler (including potentially multiple times).

    • @McCulloughAssociates
      @McCulloughAssociates  Рік тому

      Kind-of the definition of virtual machine. The CLR (as well as the Java VM) does cache the native translation at runtime and .Net applications are certainly fast. But the whole idea of "managed code" is that the application runs in a runtime that is on the lookout for common problems like null references and index out of bounds, etc. That does add to execution time. Not saying it's good or bad.

    • @clonkex
      @clonkex Рік тому

      ​@@McCulloughAssociates ​It's not though. By that logic, C++ caches the "native translation" when you compile. In that regard, C# is the same as C++ except that it finishes the compilation at runtime instead of ahead of time. It also doesn't run "in" a runtime. It's executed _by_ the CLR, but it's running natively, on bare metal, exactly the same as C++. The CLR is an extra step but not an extra layer. Uncompiled methods are compiled to stubs that call back into the CLR. Once the JIT has completed compilation, it modifies the stub to point to the compiled code and returns execution to the program. The checks and guards (like array bounds checking, which, arguably, a C++ programmer should be doing anyway) are compiled in. It's still native code, just with built-in safeguards. It's also worth noting that the safeguards are not even added when it's statically provable they're not needed.
      I can't find any definition of VM that fits what C# and the CLR are. It's just a different way of compiling native machine code. I'm not familiar with Java but I would suggest that JVM is a misnomer.

  • @toby9999
    @toby9999 2 місяці тому

    This is very good. Too many C++ vs. this or that comparisons usually start with the ridiculous C++ is old and dangerous and should be abandoned kind of stuff.

    • @McCulloughAssociates
      @McCulloughAssociates  Місяць тому

      I coded in C++ back when it was new and dangerous! It is only dangerous when developers are inexperienced or inept. Modern C++ is even easier to code bug free!

  • @gasparmc
    @gasparmc 10 місяців тому

    Thanks, sir for this robust overview

  • @rocketmangenesis
    @rocketmangenesis 2 роки тому

    Gosh.....I am so discouraged, but won't give up trying to learn one of those languages. I am sure this was helpful for someone that have more than a basic idea of coding. Maybe one day I will understand this video in two years. :)

  • @florinf2003
    @florinf2003 Рік тому

    You can call GC manually in C#.

  • @jhonyortiz5
    @jhonyortiz5 Рік тому

    This was very comprehensive, thank you.

  • @JackKyaden
    @JackKyaden 2 роки тому

    What is the best to start to program a game?

    • @McCulloughAssociates
      @McCulloughAssociates  2 роки тому

      Use Unity with C# - probably easiest to learn - unity.com/
      For C++, use UnrealEngine.com

  • @BobbyLonely
    @BobbyLonely 2 роки тому

    to program video games c++ or c# is recommended. I already have basics in programming so I have to choose a language and I don't know which one to choose. :(

    • @Phroggster
      @Phroggster 2 роки тому

      C++ vs. C# in the gaming world is kind of a misnomer. Use whichever one you're more comfortable with, or whichever one your game engine makes available to you. In Unity, that's probably going to be C#, Unreal C++ (or blueprints), etc. If you're building one from scratch and are equally fluent in both languages, C++ will give you slightly better performance at the expense of increased code verbosity, while the C# compiler will give you much easier-to-interpret error messages and the language paradigm itself will give you improved code brevity. In the end though, it doesn't really matter to anyone outside of the development team. I've seen games created in Lua or Python that performed better than similar ones written in C++, and it all comes down to your preference.
      I've also seen people make games in C# to lay out the essential gameplay framework, then switch to hosting that game library within C++ for the more advanced rendering, networking, and compiler optimizations it offers.

    • @KyleDavis328
      @KyleDavis328 2 роки тому

      You choose the one being used by the engine you want to use. Unity used C# for scripting, Unreal uses C++ for scripting, other engines use other languages or in many cases offer their own in-house language.

  • @Songfugel
    @Songfugel 2 роки тому +2

    While there are very good points here, most of them are not quite true or accurate. Still, gives a better than normal breakdown of the two, even if most of the information is not quite true, it is accurate enough for most purposes of the normal novice programmer.
    Before C++ 20, the choice of which one to learn first was really easy win for C#, now I would consider them both equally valid based on your preferences and what sort of programming you want to do.
    C# is a hybrid and extremely flexible language only limited by the skill of the user, it is FAR less opinionated than people think it is.
    You can do almost anything a C++ does with C# and with enough skill, can in some scenarios even achieve faster speeds than C++ due to the ability adapt and optimize and recompile some parts of the code even at runtime based on detected patterns.
    Also C# can use C/C++ libraries as needed as part of C#, and C# can actually decide when the code is compiled, it doesn't have to be compiled at runtime, but can also be precompiled as native machine code at compile time

  • @paap2517
    @paap2517 4 місяці тому

    New sub here! Perfectly explained, thank you!👏🏽

  • @kirillsviderski4739
    @kirillsviderski4739 2 роки тому +1

    Sent this to my students! Subscribed)

  • @JohnWasinger
    @JohnWasinger 2 роки тому +2

    5:10 enum types do not have member functions.

    • @McCulloughAssociates
      @McCulloughAssociates  2 роки тому

      Correct - a bit of a misstatement. Using helper functions or an enclosing struct or class, we can simulate member functions similar to java.

  • @thingyee1118
    @thingyee1118 2 роки тому +1

    Detailed comparison

  • @vekmogo
    @vekmogo Рік тому

    As a Java programmer, this just makes me want to learn C# in conjunction with Golang.

  • @MrBlazzerBoy
    @MrBlazzerBoy 2 роки тому +2

    Is C# kinda like JAVA?

    • @maxfrischdev
      @maxfrischdev 2 роки тому

      Kinda, yes. And java would have been the correct contestant to compare C# to, not C++..
      You can compare C++ with Rust for example

    • @Grimlock1979
      @Grimlock1979 2 роки тому +1

      C# 1.0 was like Java but C# has evolved a lot further than Java since then.

    • @edwinmartens7459
      @edwinmartens7459 2 роки тому

      C# was/is Microsofts aswer to, and implementation of Java 😉

    • @wopmf4345FxFDxdGaa20
      @wopmf4345FxFDxdGaa20 2 роки тому

      @@maxfrischdev You can always compare.

  • @j.r.8176
    @j.r.8176 5 місяців тому +2

    This comparison makes no sense. Two tools for two very different jobs.

  • @panjak323
    @panjak323 Рік тому

    Why not learn both ? C++ for low level and C# for scripting and prototyping. They are similar enough.

  • @kingshahzad78
    @kingshahzad78 2 місяці тому +1

    Thanks Dear

  • @MichaelElfial
    @MichaelElfial 2 роки тому +6

    The very idea to place these two in the same sentence is stupid. They serve diametrically different purposes after all (despite the fact that it is possible to do almost anything in C++ this does not put it in the same category). C++ is low level language and can target not only the "metal", but it is still a low level language supporting higher level abstractions one can use as much as he wants or not use them and keep as close to the C level in the other extreme, but the main point is C++ is not bound to a bulky runtime without which C# cannot exist. So, this angers me - all those attempts to compare these as languages and not as totally different things in the programming ecosystem.

    • @Ormaaj
      @Ormaaj 2 роки тому

      "C++ is not bound to a bulky runtime without which C# cannot exist." Bzzt wrong thanks for playing. Though, yes, in practice C# isn't there yet. There's considerable work yet to be done to make full independence from separate runtime components possible.

    • @MichaelElfial
      @MichaelElfial 2 роки тому

      @@Ormaaj prove it

    • @Ormaaj
      @Ormaaj 2 роки тому

      @Michael Elfial The specific language doesn't matter much here. A better question is: "Can you compile a useful subset of the IL to a traditional binary that only makes use of a static linked runtime and ordinary dynamic libs that don't need jitting?" Clearly the answer is at least "kinda" because that's been possible for quite a while now. See the mono project's AoT compiler documentation for details, particularly the "full AoT" mode.
      Naturally, you lose functionality that depends on having the full JIT available particularly anything that requires `System.Reflection.Emit` isn't going to work.
      As a side-note, I don't think fully eliminating the JIT is actually a worthy goal. I do not condone companies that want to enforce total lockdown of W^X on their systems and don't think we should appease them by crippling our compilers for that purpose. Those companies have hidden agendas. They're using their usual tactics to disguise anti-consumer practices as security concerns. I've been running selective W^X on my hardenedBSD and PaX systems since long before it was possible on any of these companies platforms. And now all of a sudden they're concerned for our security...

  • @sdfsdfs13
    @sdfsdfs13 2 роки тому

    The Multi-Inheritance CHAD vs The Virgin Single Inheritance

  • @balloney2175
    @balloney2175 8 місяців тому

    Very well explanation and differentiation.

  • @tuterruyi5178
    @tuterruyi5178 6 місяців тому +2

    Well am an c enjoyer Sooo...
    See more...

  • @onogrirwin
    @onogrirwin 2 роки тому

    That intro gave me "Developers, developers, developers, developers!" vibes

  • @ExSpoonman
    @ExSpoonman Рік тому +1

    If you learn C# first, learning C++ may be more difficult, but it is a helluva lot more fun. Edit: At least it isn't that turd, Java. 🤮

  • @jugnu361
    @jugnu361 2 роки тому +3

    Nothing Like C++

    • @Songfugel
      @Songfugel 2 роки тому +1

      Yes, then it would just be called C++. However, there are languages that can do what C++ does, C# being one of them, since it is actually extremely close related to it when run in unsafe native mode and precompiled to native at compile time

  • @adamodimattia
    @adamodimattia 2 роки тому

    I've never seen and can't find what means "value" vs "reference" based language, anyone?

    • @McCulloughAssociates
      @McCulloughAssociates  2 роки тому +1

      Great question.
      In C++, by default, a variable is large enough to hold the data (value) and a copy is passed to functions. emp in the line below is all the memory for employee data and copies are made if passed or assigned in c++. That statement in c# declares a reference, the equivalent of Employee* in C++. C# isn’t pure reference based as primitives have value semantics.
      Employee emp;
      In C#, emp is a null pointer (reference) and an object must be allocated from the heap via new. Only the reference is passed or assigned, not copies of the object.
      Most functions in C++ are defined to pass references or pointers to avoid the cost of making copies, but that requires explicit syntax (* or &).

  • @etaashmathamsetty7399
    @etaashmathamsetty7399 2 роки тому

    4:48
    RIP typedef
    6:02
    RIP malloc and RIP free

  • @stevenbliss989
    @stevenbliss989 2 роки тому +3

    Thanks for the comparison,having used all three extensively. I agree with most of it. When it comes to learning, Pascal is best (i.e. Delphi), which gives you the best of C++ & C# worlds. This is weird because the designer of C# also designed Delphi. C# could have been great but due to M$ mandates is CRAP!

    • @McCulloughAssociates
      @McCulloughAssociates  2 роки тому

      Glad it was helpful!

    • @davidmartensson273
      @davidmartensson273 2 роки тому +2

      Anders Hjelsberg also designed Turbo Pascal which is/was a big compiler on PC in the 80s-90s before Delphi.
      He is also one of the creators or Typescript.
      And claming C# is crap without stating its you personal opinion is a bit over the top since its in the top 10 most popular languages and used in thousands upon thousands of projects.
      If it was really crap it would not be that big, no matter what personal preferences it disagrees with :P

  • @wastedkafir9134
    @wastedkafir9134 2 роки тому +1

    *want to become a programmer and write code that runs faster with less memory go for c/c++ else go for any of the script writers language c#, java, Borneo, Sumatra and what not*

  • @UlulaSilvia
    @UlulaSilvia 2 роки тому

    Just one little big problem with C# "windows / microsoft tech only"