C vs C++

preview_player
Показать описание
In this video I evaluate the differences between C and C++ and which is best for you.

Join this channel to get access to perks:

Music Credit:

Рекомендации по теме
Комментарии
Автор

Hey thanks for watching! Made a small mistake in the video in saying any C code is valid C++ code. In more recent C++ this actually not the case, but is true for most cases.

conaticus
Автор

C is the only language where I feel like I can focus on debugging my application rather than debugging my knowledge of the programming language. C++ tends to be at the completely opposite end of this spectrum.

jakubsebek
Автор

I had dated before. Python, Java... I had a brief fling with Ruby on rails for a week, but C was my first love. I didn't know what I was doing and knew it probably wouldn't last, but I was completely infatuated - Bonny and Clyde, Beyonce and Jay Z kinda love. Then I met C++. She was smart, fast, a handful, but I was convinced she'd open up to me if I spent the time. C++ has cheated on me 7 times, robbed my house and sold my stuff to fuel its crack addiction. One time I got home to find that she had smashed my TV, living room and kitchen because I put an array index that was out of bounds. Her partner in crime, Compiler, is a total nut job who convinced her that EVEN THOUGH THEY KNEW THE INDEX WAS OUT OF BOUNDS, they just try access the memory location OUTSIDE of the array. They didn't even bother to tell me why they did it - just lectured some BS about principles and origins or something. She's crazy! if I could talk to my past self, I would tell him, "you're an electrical engineer so you're only gonna use Matlab and python anyways. save yourself the effort."

mikeruchington
Автор

NOTE to beginners: You don't have to use OR learn all the C++ features and keywords. If you're writing your own code you don't need to use the gazillion features of C++. You pay for what you use. Learn the basic/simple language first. Don't bother with templates/metaprogramming yet. From templates learn only the very basics on how to call/use templates. Don't bother learning how to write templates. As time passes and you become more accustomed to the basic stuff then you will be learning the more advanced stuff more easily and naturally. Learn: variables, pointers, references, arrays, fundamental types, functions, classes, const keyword. Then learn basic stuff from the STL: std::string, std::vector, std::map.

sledgex
Автор

I love C and C++ for different reasons. C for its simplicity and you can focus more on the functionality of your code rather than the design and C++ for its massive versatility. C and C++ are versatile in their own right, however C++ does have classes and I find it easier to implement certain things like Data Structures. Also, I am not a fan of OOP (even though I do use the paradigm in my past jobs and current job), so I am glad OOP is more like an option in C++ rather than a requirement. OOP is a tool, but it is not some miraculous multi-tool that should be used for everything.

programmertheory
Автор

Don't set out to learn a programming language! You won't enjoy it!
Set out to learn how to make X thing in that language. The more you use it, you will get used to the language, and it will become second nature to you in the end.

soulextracter
Автор

I'd like to point out that your statement regarding how C++ is a super-set of C which means that all C code can run in C++ is completely false, C++ is no longer a super-set of C, many aspects of dialects regarding the standard of C aren't allowing inside of C++, a big example is things like VLA and other things that are valid in C but aren't in C++. Overall a nice video however.

qrterergtg
Автор

You can just write C code in C++ and use the C++ features you want

atomicptr
Автор

I really like modern C done well. Light modules and handles for most things gives you a very extendable and clean code

LDdrums
Автор

Would like to see a video in C or C++ in game design, A.I., aerospace software engineering, robotic software engineering, mobile software development, embedded software dev, and I.O.T(internet of things (edge and cloud computing)) regarding C or C++ software? Great short C/C++ video by the way.

Mnerd
Автор

I bought a used copy of "the C programming language" book a few days ago, and I am waiting for it to arrive. I like object oriented code, but I thought it may help with my understanding of computers to learn a lower level language like C.

carlosjohncosta
Автор

I have carefully considered whether C or C++ is a better fit for me, and have come to the conclusion that, because I am a homosexual, I should stick with Javascript.

I'd like to thank the erudite gentlemen on 4chan for helping me with this decision.

Asdayasman
Автор

You don't need to understand every intricacy of c++ to write effective and working c++ code. You don't write code to utilize the language. You use the language to write your code. If you want to do something, then do it with what you are given. And c++ gives you more. If you want to use printf, then by all means, use printf, even in c++. Just remember that if you use it wrong, you will get a security problem. the cout stream object on the other hand has no such issues. That aside, cout isn't all that complicated, and is used only to write text to stdout. Now consider you want to change your code to write your text to a file instead. You just switch out the stream object, everything else stays the same. in c you need to rewrite your function calls.

FalcoGer
Автор

This guy deserves more subs. This is the kind of video I need in my recommended page and very entertaining to watch!!!

quadrarilific
Автор

I've used both C and C++. I started learning C++ and then I started learning C. C++ is nice and fast, though it does feel needlessly clunky at times, but depending on what you've asked of me will change on which I will use.

squashedoranges
Автор

Thank you, you have been added to one of my educational and overall enjoyable cs related youtuber. (Just fireship). Love the style and keep it up!

kevinchin
Автор

I've used both C and C++ fairly extensively (although I'm nowhere near the 10 years of C++ experience people usually joke about being required to be considered advanced).
I've done things from embedded systems programming to server backends and compilers in both with a lot of things in-between.

C++ is definitely my favourite to work with. For many applications the often times slight increase in speed from using C is just not worth the added hassle and development time.

I like our god emperor Linus Torvalds as much as the next guy but the words of someone who's been working on kernel code for decades are not to be taken as holy gospel for the vast majority of use cases.

All of this to lead into my next point: Rust. I love it. Absolutely everyone who uses it loves it. It's great.
Although currently still a fairly young language, most of the utility libraries one might need are already present and the comfort of development once you can use it without much trouble is unparalleled when couple with all of its selling points.
Work is even being done to make it viable for extremely low level cases line kernel development, and the embedded systems Rust ecosystem is becoming better day after day.

C as a beginner language.
Rust after doing a fair amount of projects in languages with varying paradigms (including functional if possible).
C++ when you're just looking to learn a one size fits all systems programming language.

All of this is of course an opinion and I am making no claim of objectivity.

HoloTheDrunk
Автор

"Learn C before you learn C++" is like telling someone to learn Latin before learning Italian.

Yes, it might help you see where some concepts stem from, but 99% of the time that just isn't worthwhile. They're not really the same at all.

halfbakedproductions
Автор

I have been working as a C developer for about 2 years. I know that is not much compared to other veterans around the web, but I had my share with it. Strange bugs are just, interesting. I even found myself debugging for symbol names and GNU Hash table in the native binary. (There was a problem with the compression ant other low level operating system stuff and that really happens I am not gonna lie)
However, I know Java and JS as well as C#. Maybe not as much as C, but I would argue that knowing C is not that much. Understanding the binary itself is a bigger accomplishment rather than knowing the syntax of C language. Because everything changes when you are introduced to a different toolchain. Every compiler is different, all of them are called gcc but try running a poky compiled binary withing a toolchain of armstron (or vice versa). My point is, I know other languages and recently was working with Java and C# as a my own projects. Java as the backend of the server, using Spring Framework and C# as the mobile and desktop application using .Net Core. There is something about those languages that are just more fun than C. I am still writing stuff myself rather than using already implemented libraries but I don't find that the easiest thing in the world to be honest. I still prefer to write my own code sometimes. Sometimes for the better. And there were some instances I had to use JNI to import my C code into Java, which is entirely different than java and C but gets the job done so I am not really complaining.

The point is, if developing for the desktop and doing anything other than a game engine, please don't use C or C++. You will just make it harder for yourselves. C# is really good for interacting native windows dll libraries and sometimes even more than that. And electronJS is really cool for developing desktop applications with JS. That is really cool aswell. And I myself really like Java. I learned to code with Java, and like the OOP nature of the language. Sometimes I miss some features from JS and even from C, but every other technology has that pro/con realtionship with others. And if you are running a limited machine with a barebones linux os, know your limitations because there are some really good architectures that is really powerfull even if they don't seem like it. For example, with IMX6 from NXP I can run Java embedded with no hassle, with a little bit of performance overhead of course and I can cython compiler python project with no problem. Keep in mind that if you are using a slow flash storage, going anything other than C might be wrong because virtual runtime environments that are reuqired by the other languages are constantly using the disk for some reason and if you are using a flash storage, you will run slow and eat away your disk's write cycle lifetime. There are pros and cons like every other thing in the universe but as for the pure running performance, JIT compiling is not really that bad even on a single core 600mhz arm based low powered embedded chip. Technology has come a long way and if you feel stuck with C, like I was, try those technologies.

And lastly, for the application that I wanted to build with python was a gps service daemon, that reads nmea location information from a modem over the usb protocol (or from the modemmanager dbus api) each second and reports that location to socket using UDP protocol. Not the hardest of the jobs, or the most demanding application but works just fine and as far I haven't really seen a performance loss over the native C implementation of the same application. And if your machine has a graphics accelerator of some kind python works really well with both Qt and Gtk and considering its really good and well, and I would believe that development time using python as opposed to C will be like 5 times faster using a UI framework like GTK

melihcelik
Автор

The advice at the end was very good. I do have a clear goal, Unreal Engine. So I decided to learn C++. Then I thought maybe i should learn C first, because maybe C is exactly the same as C++, but just the skeleton of it. So if I lean C I would automatically know the basics of C++. Is this a good strategy? Or are there fundamental differences. Is C++ an actual superset of C, or does it have fundamental differences at the imperitive level? I thought i'd go from imperitive to OOP. time to google i guess.

Peak_Stone