I Tried C++, here's what I learnt...

Поделиться
HTML-код
  • Опубликовано: 22 май 2024
  • Signup for Codecrafters for free: app.codecrafters.io/join?via=...
    Grep Repository: github.com/conaticus/grep-clone
    Traffic Lights Repository: github.com/conaticus/traffic-...
    Discord: / discord
    Github: github.com/conaticus
    Twitter: / conaticus
    Join this channel to get access to perks:
    / @conaticus
  • НаукаНаука

Комментарии • 132

  • @conaticus
    @conaticus  18 дней назад +4

    Signup for Codecrafters for free: app.codecrafters.io/join?via=conaticus

  • @hamzarashid7579
    @hamzarashid7579 18 дней назад +94

    The amount of "Code Crafters" phrase he said in this video is insane.

    • @AntonioDoesMetal
      @AntonioDoesMetal 18 дней назад +9

      Yeah we're in the age of most youtube videos are ads first before they are content people need to see

    • @slimxshady6111
      @slimxshady6111 17 дней назад +4

      It’s unbearable

    • @hamzarashid7579
      @hamzarashid7579 16 дней назад

      @@slimxshady6111 Exactly

    • @phusicus_404
      @phusicus_404 16 дней назад

      ​@@AntonioDoesMetalNot most, small amount

    • @vi_k
      @vi_k 16 дней назад +1

      Fr every 2 damn seconds, literally just an ad

  • @heavymetalmixer91
    @heavymetalmixer91 18 дней назад +42

    Tbh I thought you were gonna trash the language to death as most people do, it's nice to see a more balanced opinion of it.

  • @amber1862
    @amber1862 18 дней назад +38

    C++ is great if you’re working on your own, in fact it’s fantastic, but as soon as you’re working with others it becomes a nightmare due to everyone having their own ‘accent’ of C++, accents you sometimes can’t understand at all even though it’s still the same language. I can’t read most Cpp20+ code, but C-like C++ is easy for me. Both are legal C++, everyone just does their own thing so you feel like you have to learn a new language just to understand someone else’s code. The flexibility is sooo powerful on your own though and like you mentioned, the C-like freedom to do what the fuck you like is great for quickly prototyping and just getting shit working without caring about safety.

    • @juanmacias5922
      @juanmacias5922 18 дней назад +2

      By "accent", do you just mean version syntax?

    • @anstropleuton
      @anstropleuton 17 дней назад

      @@juanmacias5922 Far more than just that... syntax is barely scratching the surface.
      Here is how I would interpret "accent" as:
      using namespace std; vs. not
      Using auto vs. not
      Using C++11 compiler settings vs. not
      Using fancy algorithms vs. not
      Using lambdas vs. not
      Don't even get me started with object oriented stuff... vs. not
      Using class vs struct
      Using templates vs. not
      Using utilizing inheritance vs. composition
      Using std::string vs. const char * (std::string is IMO superior, but again... accents)
      Using trailing return type function declaration style vs. traditional
      Splitting stuff into multiple files vs. not
      Coding all of your program in a header file and slapping `inline` before each function so the compiler doesn't complain about it (I do that btw), vs. not
      Using some third party library vs. implementing your own
      Using fancy features from the latest unfinished C++ standard (C++26 maybe?) before they are refined, vs. not
      Using modules and `import` stuff vs. not (I am honestly still waiting for some major C++ company to start using that and surprise the entire world that `import` is now a keyword in C++)
      There are more but I am lazy to think about them at the moment...

    • @anstropleuton
      @anstropleuton 17 дней назад

      Did my reply just got deleted or did youtube not register it at all.... glad I had message text in a file so here it is:
      @@juanmacias5922 Far more than just that... syntax is barely scratching the surface.
      Here is how I would interpret "accent" as:
      using namespace std; vs. not
      Using auto vs. not
      Using C++11 compiler settings vs. not
      Using fancy algorithms vs. not
      Using lambdas vs. not
      Don't even get me started with object oriented stuff... vs. not... yeah let's get started:
      Using class vs struct
      Using templates vs. not
      Using utilizing inheritance vs. composition
      Using std::string vs. const char * (std::string is IMO superior, but again... accents)
      Using trailing return type function declaration style vs. traditional
      Splitting stuff into multiple files vs. not
      Coding all of your program in a header file and slapping `inline` before each function so the compiler doesn't complain about it (I do that btw), vs. not
      Using some third party library vs. implementing your own
      Using fancy features from the latest unfinished C++ standard (C++26 maybe?) before they are refined, vs. not
      Using modules and `import` stuff vs. not (I am honestly still waiting for some major C++ company to start using that and surprise the entire world that `import` is now a keyword in C++)
      Don't even get me started on coding style differences: clang.llvm.org/docs/ClangFormatStyleOptions.html (I don't want to talk about that)
      There are more but I am lazy to think about them at the moment...

    • @diadetediotedio6918
      @diadetediotedio6918 17 дней назад +3

      I don't care anymore about different coding styles, because once you've learned like 3 or more languages everything feels the same. I think the problem is more about bad code than "coding accent" or "learning a new language" in most cases.

    • @gintoki_sakata__
      @gintoki_sakata__ 16 дней назад

      ​@@diadetediotedio6918allegedly

  • @nibodhdaware
    @nibodhdaware 17 дней назад +5

    Bro has become an full time employee now, sponsored video after sponsored video

  • @anwarulbashirshuaib5673
    @anwarulbashirshuaib5673 17 дней назад +2

    1:03 That quote sums up C++ perfectly

  • @wormisgod
    @wormisgod 18 дней назад +2

    Conan plugin with CLion makes dependency management fairly straight forward

  • @SIMULATAN
    @SIMULATAN 18 дней назад +6

    TL;DR: i want to break free

  • @Byynx
    @Byynx 14 дней назад +1

    A header file is just copy paste tool, literally, we don't need to use header files but because you have to declare in the source file every variable, function or class that you use, specially if they come from other source files(.cpp), than header files are a must to not having to write all those things on each source file. Header files just literally copy and paste their content inside the source file as if we had writen ourselves.

  • @adamlasak1536
    @adamlasak1536 15 дней назад +1

    C/C++ is like my very old friend, still living in punk-rock past times thanks to which I'm a programmer today. My first programs I developed at elementary school with this bastard gave me pureblood knowledge about how everything works under the hood. Programmers who tried this should be branded so everyone knows they survived the main boss.

    • @unknownuser85300
      @unknownuser85300 11 дней назад

      Hey there! Im still in elementary school and going to highschool next year, i learned lua with love2D, and i wonder is there any good sites or videos to learn courses about lua or love2D framework utils? I already watched some steve teacher videos but i didnt feel comfortable with his video style, challacade is a good channel for giving out examples of how things works like enemy movement towards player, talks about love2D useful tools, but i cant really understand anything that doesnt have a code example, i cannot just understand a concept without code and implement it in my game, and i also suck at communicating with people on any platform so people cant really help me either!

  • @luxluth
    @luxluth 18 дней назад +1

    On unix systems. You can install libs like sdl and just include them in your code. No need to copy paste the hole lib thing

  • @MysticalAurora9u4u3ksb
    @MysticalAurora9u4u3ksb 18 дней назад +13

    I've been learning C++ and every time I compile I just pray I don't get an error.

    • @Simone-uu8ne
      @Simone-uu8ne 17 дней назад +1

      as someone who tried to learn Rust, I totally get what you mean lol

    • @aniketbisht2823
      @aniketbisht2823 11 дней назад

      It's great that the errors are caught at compile time. That's the point of modern C++.

  • @brockdaniel8845
    @brockdaniel8845 18 дней назад +6

    without address sanitizer you don't know if you had UB 😆

    • @ohwow2074
      @ohwow2074 15 дней назад +1

      Undefined behavior sanitizer is for that

    • @itsmeagain1415
      @itsmeagain1415 15 дней назад

      @@ohwow2074 LMFAO

  • @LiLAlien69
    @LiLAlien69 14 дней назад

    Nice tutorial again!

  • @skeleton_craftGaming
    @skeleton_craftGaming 13 дней назад

    Yeah it does. I actually agree with your first point about compilers and libraries, but that's the price you pay for having a well-defined ABI
    , Microsoft's CL is nice because ot uses language extensions to the `#comment` pragma that allows you to define lib paths in files...
    You will eventually have to use pointers, however the STL [standard template library] std:: unique_ptr and std::shared_ptr That abstract the allocation and deallocation away so they're basically equivalent to using references.

  • @thecloudrazor
    @thecloudrazor 18 дней назад +12

    I love C++. I love Rust even more. I love low-level languages!

    • @lumiey
      @lumiey 18 дней назад +3

      Same, I just switched to rust recently and it's awesome not having to deal with compiling and awful looking C++ legacy syntax, rust is super clean and well thought out
      I rate it C+++++/C++

  • @saadmuhammad3119
    @saadmuhammad3119 18 дней назад

    Could you make a video about you making these compilers and operating system projects in C/C++ that'd be really helpful.

  • @aniketbisht2823
    @aniketbisht2823 11 дней назад

    You should use std::span and std::string_view for passing "reference" to array types like std::string and std::vector.

  • @ninjaasmoke
    @ninjaasmoke 17 дней назад +6

    this is just one long ad

  • @Fetrah2
    @Fetrah2 6 дней назад +1

    would like to see u trying assembly (:

  • @somerhaha1687
    @somerhaha1687 17 дней назад

    I'm making a compiler in C++ for my own language and it's been fun :)

  • @aniketbisht2823
    @aniketbisht2823 11 дней назад

    I would recommend meson instead of Cmake or make. It integrates with Cmake and has Python like syntax and uses ninja as a back-end for compilation which is the fastest C++ build system.

  • @atesztoth
    @atesztoth 14 дней назад +1

    Not to be rude or anything, but I feel like I have to mention this. Actually at 4:48 that error message tells you the problem, and literally 1 min of googling can help with understanding it.
    This is not a bad error message, because even if you don't know anything about what it exactly means, reading the words "undefined reference" to sg. may help you start thinking about what could be happening in the background.

  • @revengerwizard
    @revengerwizard 18 дней назад

    Make sure to use Address Sanitizer if present

  • @Byynx
    @Byynx 14 дней назад

    Is that font Jetbrains Mono ?

  • @dreamsofcode
    @dreamsofcode 17 дней назад +3

    Such a good observation on writing code freely. It's one of the reasons I still reach for C/C++ instead of Rust at times.
    Great video, dude!

    • @Maagiicc
      @Maagiicc 17 дней назад +1

      Real question. Why do you couple C and C++ when they are two completely different languages?

    • @dreamsofcode
      @dreamsofcode 17 дней назад +2

      @@Maagiicc Mainly because I'll reach for either C or C++ at times, depending on what I'm looking to do.

    • @conaticus
      @conaticus  17 дней назад

      Thank you man ❤

  • @imran3509
    @imran3509 18 дней назад +13

    C++ is like Gambling, There are no losers Only Quitter

  • @nerdastics3987
    @nerdastics3987 14 дней назад

    heh, yeah the c++ gcc stl is a bugpile, so if you get a template error, that error message is virtually unreadable

  • @juniordevmedia
    @juniordevmedia 17 дней назад

    I learned more about codecrafters than c++ in this video!

  • @roccociccone597
    @roccociccone597 15 дней назад +1

    I did c++ a while back and honestly it’s not anywhere near as bad as people always make it out to be. Zig is still cooler

  • @kinershah464
    @kinershah464 16 дней назад

    Explore other paradigms other than OOP. You will realise how sometimes OOP isn't required, plain functions are more than sufficient.

    • @Spartan322
      @Spartan322 16 дней назад

      Actually depends, for example virtual inheritance is more scalable for UI interfaces then the functional approach, (hence why almost every widely used UI solution will take advantage of virtual inheritance directly or indirectly) and funny thing is that in C++ virtual function calls don't by themselves even have notable performance implications, (if you benchmark virtual function calls its literally a 50/50 chance whether any direct function call will be slower then the virtual function call version, even on the same compiler, compiler flags, and CPU you won't get deterministic results for any run) the inheritance and OOP is absolutely a valid tool, use the right tool for the job and sometimes they are the best solution.

    • @kinershah464
      @kinershah464 15 дней назад

      @@Spartan322 I meant to say, don't complicate things when you know it's just a simple function that you need to write, don't create a class only to have static public functions..
      So you are right in the way it depends on the use case.

  • @imran3509
    @imran3509 18 дней назад +1

    i am a C++ programmer for past 3 years,i dont understand much ,yet i use it anyway and love it

    • @aboliguu1168
      @aboliguu1168 18 дней назад +5

      How can you use a language for 3 years and not understand much? I think you should try a bit more advanced projects to gain deeper knowledge

    • @imran3509
      @imran3509 18 дней назад +1

      ​@@aboliguu1168 you need to learn more about C++ and then talk to me .....

    • @juanmacias5922
      @juanmacias5922 18 дней назад

      @@aboliguu1168 or read the docs lol

    • @Leonhart_93
      @Leonhart_93 17 дней назад +2

      Just say you understand it decently now, if you try to appear way too humble considering it's been 3 years then it either sounds fake or it sounds like you put in no effort at all.

    • @anstropleuton
      @anstropleuton 17 дней назад

      @@aboliguu1168 Some people really like to prefer the C way of doing C++ (aka not using fancy C++ and C++ standard library features even though they exist)
      I think it's all fine, it can make up for some verbose code that you can easily edit... Unless your name is performance

  • @Classfied3D
    @Classfied3D 17 дней назад

    Yes someone shares my pain with installing SDL
    Now do it with no low level knowledge and on an old version macos

    • @heavymetalmixer91
      @heavymetalmixer91 16 дней назад

      SDL is always painful to use, unless you use the big Visual Studio for it

  • @__hannibaalbarca__
    @__hannibaalbarca__ 18 дней назад +2

    C++ is not made for programmer, it’s made for Mathematician Programmer. Yeah i forget to tell you C/C++ isn’t for lazy people.

  • @user-ce6cs4yb8n
    @user-ce6cs4yb8n 18 дней назад +2

    I'm learning that coding hurts my brain.

    • @NotLiamH
      @NotLiamH День назад +1

      Yes it does, especially when the project gets long to like 300 lines of code and all the syntax, all the languages, it gets confusing.

  • @Spartan322
    @Spartan322 16 дней назад

    C++20 Concepts actually solve type debug crap stupid easy, it tells you why it failed and it doesn't spit a thousand lines of useless junk at you.

  • @crossscar-dev
    @crossscar-dev 17 дней назад

    Personally C++ is my favorite language and toru be honest I just gave up on trying to compile on windows. When I use linux I just use pkg-config and I'm done

  • @andrewzhang1834
    @andrewzhang1834 18 дней назад

    Why do you use Windows 10?

  • @elturco9573
    @elturco9573 15 дней назад +1

    Siento que no existe razon alguna de ir con C++ que no sea exclusivamente el rendimiento o por pura necesidad, o porque no existe otra herramienta para el trabajo. Durante muchos años estudie C++ porque queria hacer un motor de juegos, y porque lo disfruto, por ser de bajo nivel y todo eso, aprender mas sobre la computadora, y le tengo cariño, pero a su vez entiendo que de alguna manera es la evolucion natural de lenguajes mas antiguos, y es el resultado de un comité muy politizado por necesidades de grandes corporaciones mas que un diseño que sabe lo que quiere, pero que se adapto sorprendentemente bien a las necesidades modernas, bueno, quiero decir... no se resigno a morir. Creo que no tiene salvacion, pero la humanidad depende de el. Mmm, no lo se... lo siento asqueroso pero no tenemos algo mejor supongo

  • @Alucard_Seven
    @Alucard_Seven 18 дней назад +1

    I love C++, and hate it at the same time.

  • @Nerthexx
    @Nerthexx 10 дней назад

    2:40 yes, because you aren't using an IDE... 👨‍🏭

  • @rpxdytx
    @rpxdytx 15 дней назад +2

    I highly prefer C, C++ is full of verbosity and things that feel rather useless. About Rust, the borrow checker is annoying 999,99% of the time, but at least you don't have to deal with segfaults that give no clue of what happened (besides a core dump, which you need to configure in your os to actually get useful info), and allocations are better handled in rust. You can clearly see that a Box or a Vec performs an allocation, but in C++ any class can do this->field = new Value(); in the constructor (yeah, in rust any struct can still have box fields, but a box is clearer than a pointer, and i think that writing unique_ptr is a bit too verbose)

  • @bee_irl
    @bee_irl 17 дней назад

    oh, so you THINK you didn't encounter UB

  • @TechTutor429
    @TechTutor429 18 часов назад

    Great

  • @samtonetto3294
    @samtonetto3294 17 дней назад

    Compiling and linking are such a pain because you are using Makefiles instead of CMake. Using CMake is modern C++ best practice.

  • @binitrupakheti4246
    @binitrupakheti4246 18 дней назад

    Thanks, but friendship ended with C++ now Odin is my best friend

  • @JoaquinDev
    @JoaquinDev 14 дней назад +1

    thinking C or C++ is pure skill issue. The true negative of C is that there are a million ways to write the same line of code, so understanding other's code sometimes can be challenging or be utterly Impossible. I wish people just sticked to writing C-Like C++, at the end of the day it is supposed to be an improvement/modern iteration of C.

  • @kotofyt
    @kotofyt 18 дней назад

    I’ll be trying C++ to C…

  • @nikv5
    @nikv5 16 дней назад

    Had to stop the video cause of the constant light mode flash bangs, hurting my eyes at night.

  • @BlackneeedWasHere
    @BlackneeedWasHere 18 дней назад

    Finally got 10 minutes after posting

  • @IamPyu-v
    @IamPyu-v 7 дней назад

    To me references are just pointers where you don't have to explicitly dereference them and without pointer arithmetic.
    Otherwise they are the same thing under the hood. I don't get why people overexaggerate things like pointers.

  • @aniketbisht2823
    @aniketbisht2823 11 дней назад

    4:48 Dude, just READ it. It literally says "undefined reference to ...". It's a linker error. You are probably not providing it with the .cpp file that contains definition for that function.

  • @aboliguu1168
    @aboliguu1168 18 дней назад +3

    C++ experience on windows is absolute garbage, unix based operating systems (including macos) are way better in terms of libraries, build systems, compilers etc. On windows, you are often faced with weird msvc stuff (even outright bugs…) and switching to other compilers is not frictionles.
    Even cmake is bs because you are very strongly pushed to use it as a visual studio pre-step (absolute fucking shit, works as intended like 20% of the time), while on mac and linux, it just creates a makefile. (Easy, fun, simple)

  • @kuzeyrl
    @kuzeyrl 18 дней назад

    cool

  • @SteveBClark
    @SteveBClark 18 дней назад

    Live coding videos

  • @Ayymoss
    @Ayymoss 17 дней назад

    Make longer videos.

    • @1..1..1..1H
      @1..1..1..1H 15 дней назад

      No I can't hear "code crofters" for another 3 minutes

  • @SimGunther
    @SimGunther 17 дней назад +1

    2:50 Buddy, you can do OOP (of Smalltalk fame) and class oriented programming (modern OOP) in C++. No one is gonna bite you if you don't give in to the C gods and make everything a struct.
    You'll just have to silently judge yourself on why OOP code didn't maximize cache utilization for ultimate performance compared to data oriented design. BTW none of these paradigms should be ham fisted into your design because "they say so". If it's solved better and it runs faster with OOP compared to the same code written in DOD principles, that's fine. ;)

    • @diadetediotedio6918
      @diadetediotedio6918 17 дней назад +1

      Cache utilization is also overhated most of the time. UI applications and the majority of code will not make such a performance difference if you are or not correctly using cache and making your code predictive, so OOP is not the one to be judged here: most of the performance problems in large software usually comes from extremely misusing memory and relying hugely on I/O operations.
      So I like DOD more (generally) because it induces better composition and reusability of software rather than because it maximizes cache utilization.

    • @SimGunther
      @SimGunther 17 дней назад

      @@diadetediotedio6918 So you're telling me there's zero performance difference between:
      struct oopcoord { int x; int y; int z; };
      struct oopcoord coords[5000];
      // data init here
      for (int i = 0; i < 5000; i++)
      coords[i] += 8;
      // same for Ys and Zs
      And:
      struct dodcoord { int *x; int *y; int *z; };
      struct dodcoord coords;
      // data init here where we have 5000 Xs, Ys, and Zs
      for (int i = 0; i < 5000; i++)
      coords.x[i] += 8;
      // same for Ys and Zs
      I'd love to see your benchmarks on why these two produce the same performance so 10+ years worth of DOD talks regarding performance superiority over OOP are finally proven wrong 🤣

    • @SimGunther
      @SimGunther 17 дней назад

      @@diadetediotedio6918 I'd love to see your benchmarks A/B testing DOD code vs OOP code just so you can prove 10+ years of DOD talks asserting superior performance using DOD wrong 🤣

    • @SimGunther
      @SimGunther 17 дней назад

      ​@@diadetediotedio6918 Any benchmarks we can see proving your performance statement (DOD vs OOP) and exactly why they're equivalent in performance behind your assertion of heavy IO usage or UI framework code being a mess in general?

    • @diadetediotedio6918
      @diadetediotedio6918 17 дней назад +1

      @@SimGunther
      I'll correct the misunderstanding here right away. Obviously there is a performance difference* in using DOD from OOP if we are talking about how fast algorithms structured in either way would run in a computer, I'm not disputing this fact.
      What I'm disputing is about perceived performance, and that's why my examples were UI applications and most of normal code paths. I'm talking that in this specific sense, the perceived performance will not differ significatively, dot.

  • @nevokrien95
    @nevokrien95 16 дней назад

    C++ is kinda cool. I prefer c but of your fine with not doing too many weird stuff its nice

  • @eineatombombe
    @eineatombombe 18 дней назад +1

    try c

  • @__hannibaalbarca__
    @__hannibaalbarca__ 18 дней назад

    If you don’t, know C/C++, too much thing…..

  • @andrejbartulin
    @andrejbartulin 17 дней назад

    I enjoy C++ and its all STL features

  • @Dino-Kupinic
    @Dino-Kupinic 15 дней назад +1

    6 minute ad

  • @TheRealMangoDev
    @TheRealMangoDev 18 дней назад +1

    1 view in 20 seconds

  • @elmariachi5133
    @elmariachi5133 17 дней назад

    C# does not compare to C++ / Rust. It's not a serious competitior, as you cannot even code drivers for most Microsoft's toy.

  • @Faraday2122
    @Faraday2122 18 дней назад

    First, guess what? :D

    • @moonyl5341
      @moonyl5341 18 дней назад +1

      no

    • @Faraday2122
      @Faraday2122 18 дней назад

      ​@@moonyl5341yes

    • @TheRealMangoDev
      @TheRealMangoDev 18 дней назад +1

      no ur not i was first

    • @Faraday2122
      @Faraday2122 18 дней назад

      @@TheRealMangoDev it said uploaded 1s ago when I opened

    • @anstropleuton
      @anstropleuton 17 дней назад

      @@Faraday2122 youtube isn't consistent on which comment is first, so.....

  • @Korgeneral-Hardcore
    @Korgeneral-Hardcore 18 дней назад

    //First comment

  • @lifeofme702
    @lifeofme702 18 дней назад +1

    Under 1 hour gang
    👇

  • @wahidislamlinad
    @wahidislamlinad 4 дня назад

    at this point change your channel name to code crafters -.-

  • @someonexd1961
    @someonexd1961 16 дней назад

    Sad to see. Get your money up bro but just fekt like code crafters ad

  • @VideosNotFound
    @VideosNotFound 18 дней назад +3

    19 likes in 4 minutes bro fell off 🧀

  • @SPimentaTV
    @SPimentaTV 15 дней назад +3

    This video is basicaly an Ad... Thumbs down 👎