C++ Is Getting a BORROW CHECKER ??! | Safe C++ Proposal

Поделиться
HTML-код
  • Опубликовано: 23 ноя 2024
  • НаукаНаука

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

  •  Месяц назад +5

    A superset of C++, this is like infinity times infinity. And there is probably already something to help with memory safety, smart pointers and containers to name a few.

    • @cheesed_up
      @cheesed_up  Месяц назад +1

      Supersets all the way down!

    •  Месяц назад

      @@cheesed_up yes! infinity-fold Cartesian products!

  • @しめい-l4m
    @しめい-l4m Месяц назад +22

    the syntax really looks like regex

    • @erikb4407
      @erikb4407 Месяц назад

      LMAO that's actually a great description of what first comes to mind when seeing it

    • @Kradse
      @Kradse Месяц назад

      agreed

    • @MikkoRantalainen
      @MikkoRantalainen Месяц назад

      I disagree. I can actually read and modify regex.

  • @zactron1997
    @zactron1997 Месяц назад +51

    I think C++ needs to adopt some kind of safety mechanism, and Rust's borrow checker is really the only option for them, so it makes sense to me. I do agree that the syntax is pretty awful, and unlike Rust (where syntax can change with editions while maintaining forwards/backwards compatibility), C++ has no way of changing syntax once codified into the standard.

    • @cheesed_up
      @cheesed_up  Месяц назад +3

      Very insightful, thanks for the comment!

    • @Peregringlk
      @Peregringlk Месяц назад +5

      The proposal from this video comes from the circle project, which adds that idea of "feature on/off", so that you can enable and disable syntactic extensions with file granularity. The safe extension is one of that features, but the circle compiler have A TON OF syntactic extensions to C++. The leader of that project has tried to bring that idea to the standard committee through this proposal but I think the committee guys are far from convinced, and so I think this proposal is kinda dead already.

    • @Spartan322
      @Spartan322 Месяц назад +4

      It won't stay that way anyway, that was an experimental syntax found in the Circle Compiler that Sean Baxter made before submitting this proposal, he didn't like p2996r5 (the C++26 reflection proposal) as it is but submitting for C++ he'll have no choice, the ^ will become the reflection operator, the ~as_pointer and ~as_length will not be viable and he'll have to rely on extending the reflection syntax for C++26 instead for that. So yeah the syntax isn't not only not set in stone, it is literally impossible for it to be like that. Personally I'd prefer if we had small keywords over the annoying ugly symbols anyway.

    • @geek2145
      @geek2145 Месяц назад +3

      Cpp already has optional safety mechanisms, like smart pointers. People can choose to use them.

    • @Spartan322
      @Spartan322 Месяц назад +4

      @@geek2145 There's not any reason to not have additional opt-in safety.

  • @yoavmor9002
    @yoavmor9002 Месяц назад +56

    Syntax so ugly even most die hard C++ enjoyes bout to learn Rust

    • @kerojey4442
      @kerojey4442 Месяц назад +6

      Have you ever seen rust code in huge projects? This is the most cursed s..t I ever seen. Stop being a sheep and think for yourself once

    • @arkeynserhayn8370
      @arkeynserhayn8370 Месяц назад +2

      ​@@kerojey4442
      Was it procedural style or functional style?

    • @kerojey4442
      @kerojey4442 Месяц назад

      @@arkeynserhayn8370 Functional

    • @arkeynserhayn8370
      @arkeynserhayn8370 Месяц назад

      ​@@kerojey4442
      You know what?
      By the time i made that comment and now that i read your reply, my opinion changed. Initially i only glanced a single rust program that was functional style, and that was pretty lean i thought maybe the problem with rust is the procedural style of writing, and functional style rust is okay; that is why i made the upper comment. Today, i glanced some other rust code, almost all of them functional style. Lets not talk about that . . .

    • @heco.
      @heco. 9 дней назад

      ​@@arkeynserhayn8370 lol

  • @furuthebat
    @furuthebat Месяц назад +4

    I first thought this was some sort of new C++26 reflections syntax, this is a whole new meta programming language on its own.

  • @MrMultiDesigner
    @MrMultiDesigner Месяц назад +72

    i write c++ to be unsafe bro wtf i don't even use condoms why i should use memory safe languages

    • @RenderingUser
      @RenderingUser Месяц назад +15

      Bro garbage collects abortions 💀

    • @arkeynserhayn8370
      @arkeynserhayn8370 Месяц назад +2

      ​@@RenderingUser
      How do you know they cause pregnancy? Maybe they go the other way around 😂

    • @RenderingUser
      @RenderingUser Месяц назад +1

      @@arkeynserhayn8370 it's about as certain as writing memory leaks occasionally

    • @danielmilyutin9914
      @danielmilyutin9914 Месяц назад +3

      @@RenderingUser ...or he does not go in v... 🤣

    • @radosmirkovic8371
      @radosmirkovic8371 Месяц назад

      Pregnancy safe condoms include:intercourse time safety, constant memory offset from sperm to egg, prohibit copying memory-your DNA to unsafe location. And lastly they guarantee that cpu-woman who "ran" your "code" won't file post execution lawsuit.

  • @Lorenzo1938
    @Lorenzo1938 Месяц назад +93

    Time to use pure C

    • @rezabani9904
      @rezabani9904 Месяц назад

      Good luck if it survive after zig 1.0😉

    • @Lorenzo1938
      @Lorenzo1938 Месяц назад

      @@rezabani9904 it's impossibile that C won't survive for many reasons (linux, vulkan, etc). But i agree that zig is far better for 2024, i don't want to use it right now only because it is not stable yet

    • @apenasmeucanal5984
      @apenasmeucanal5984 Месяц назад

      ur take’s a loser’s take rezabani

    • @arl-t8d
      @arl-t8d Месяц назад

      @@rezabani9904 🤣

    • @SystemsDevel
      @SystemsDevel Месяц назад +7

      C ftw

  • @gast128
    @gast128 28 дней назад +1

    With modern C++ practices one hardly encounter memory safety issues. When you use it in a C like way you run into above issues.

  • @erwinkonopka7071
    @erwinkonopka7071 Месяц назад +2

    Many features that are now a widely used part of syntax (lamda, range based fors) have began life in other languages.

  • @LokiScarletWasHere
    @LokiScarletWasHere Месяц назад +2

    Long as the unsafe subset is default and/or the safety features are opt-in I don't see much of a problem.

  • @_AJ_12
    @_AJ_12 Месяц назад +21

    as A C++ developer it would be a nice optional feature for developing very critical part of softwares like Drivers.

    • @danielmilyutin9914
      @danielmilyutin9914 Месяц назад +4

      @@_AJ_12 this safe unsafe add so much noise that it's just better use conventional idiomatic (if possible) C++

    • @_AJ_12
      @_AJ_12 Месяц назад

      ​@@danielmilyutin9914 this could easily mitigated by add something like "Prefered default" for borrow checking to the compiler options.
      for those who like conventional idiomatic C++ can use legacy and dont even care about borrow checker.(safe and unsafe has no effect in this legacy mode)

    • @DM-fw5su
      @DM-fw5su Месяц назад

      ​​@@danielmilyutin9914 the two security options can be used together, they are not a replacement for each other but offer complementary features. One of the features in the new proposal is the compiler makes compile time garuntees about the code inside the marked sections.
      So now its possible to mandate that certain parts of a project (on a compile unit by compile unit basis) must be written with all the security options enabled. For example areas that interact with the outside world to sanity check data handling.
      The point is expecting all developers to write idiomatic code just is not enough. They need a compiler flags that enforces the rules to do the secure thing.

    • @coshvjicujmlqef6047
      @coshvjicujmlqef6047 Месяц назад +2

      C++ cannot be used as drivers. full stop. The EH sucks

    • @MikkoRantalainen
      @MikkoRantalainen Месяц назад

      @@coshvjicujmlqef6047 C++ compilers support compiling code with exceptions. I still wouldn't use C++ for drivers, though.

  • @TheFreaxTux
    @TheFreaxTux Месяц назад +4

    Looking into the proposal, seems like it is authored by "The C++ Alliance". How legit is the alliance though? The official organization behind C++ is "Standard C++ Foundation". The Wikipedia page for C++ doesn't mention the alliance.

  •  Месяц назад +2

    At least it is opt in. When I need safety I just use Rust

  • @MikkoRantalainen
    @MikkoRantalainen Месяц назад

    Right now it seems that to convert an existing class from C++ to Safe C++ only requires rewriting about 95% of all the lines. And the lines that do not require rewriting are mostly "{" and "}" if you use Allman-8 formatting. I wish the syntax gets much nicer or it will be easier to use Rust and write a bridge between C++ and Rust in C.

  • @mathgeniuszach
    @mathgeniuszach Месяц назад +1

    Is it... really that hard to use smart pointers? Stick to unique pointers and bounds-checked containers for nearly everything and you'll be fine. Macro them too so they're shorter. This is the way I write all my C++ code nowadays anyway, and I've never had issues.

  • @riufq
    @riufq Месяц назад +1

    I'm newbie at programming. If carbon have memory safety. What's the point using rust?

    • @cheesed_up
      @cheesed_up  Месяц назад +3

      Carbon is not yet a finished language. When it's done (if it's done) then we'll see how it does in comparison to Rust and C++ :D

  • @Cinarbayramic
    @Cinarbayramic 23 дня назад

    real sigmas leak memory

  • @asdfasdfasdf12
    @asdfasdfasdf12 Месяц назад +9

    wow that syntax looks ridiculous

  • @u_long_u64_i64
    @u_long_u64_i64 Месяц назад

    Now just add everything from rust to guarantee C++ will be 80%+ safe

  • @humanistreason
    @humanistreason Месяц назад

    When people think smart pointers == safety, or thar rhis matter is just people wanting to use rust, you see how important the discussion is. I like C++, but it is true that without breaking changes tbe language will never catch up with real modern techniques and what toolig can do. New librart features cannot solve it, the language must enable things like safety, good straightforward meta programming and assist tooling functions

  • @emomaxd2462
    @emomaxd2462 Месяц назад +2

    What about runtime overhead? Will that bind runtime overhead? Will it make code runtime slower?

    • @cheesed_up
      @cheesed_up  Месяц назад +7

      To my knowledge, borrow checker doesn't add any runtime performance penalties - borrowing is essentially a set of compile-time "rules" for managing memory.

    • @zactron1997
      @zactron1997 Месяц назад +5

      @@cheesed_up Yeah the borrow checker is all compile time. However, the safe alternative standard library does include more runtime code to enforce invariants (bounds checking, etc.). As with Rust though, I suspect these checks are entirely worth it from a performance perspective. Most Rust developers don't even bother with `*_unchecked` versions of functions since the performance is close enough.

    • @Peregringlk
      @Peregringlk Месяц назад +1

      @@cheesed_up I guess the prohibition of undefined behaviour and the restriction of certain features could cause overhead in terms of optimizations that can't be applied any more. The borrow checker itself won't cause runtime overhead because it's just a set of compile-time checks, but the way user must change the code to make it borrow-checker-friendly could probably cause some performance impact.

    • @DM-fw5su
      @DM-fw5su Месяц назад +1

      As I understand it the penalty is no different to Rust but its optional. A progressive language enhancement.
      Yes there is a measurable runtime performance penalty (plenty of people have measured it in rust/cpp) but it isn't much.
      The greater penalty is the loss of algorithmic shortcuts. That is something C++ is traditionally used to achieve. The safe sections prevent many of the turbo assembler style optimizations relying on undefined-behaviour or non-portable constructs that are designed to squeeze every last programmer knows better than compiler cpu cycle out of performance.
      But its all optional, you get to choose, your employer gets to choose the regulatory body you need to comply with gets to choose. The best of all worlds for everyone and eventual end of discussion how do we make code safe from human error with the least expense.
      Now a compile flag, don't want to code in that environment that's ok there are plenty of other roles and languages to do something else in the field.

    • @shrekeyes2410
      @shrekeyes2410 Месяц назад

      The real issue is build time, C++ is extensively used in areas where iteration is in demand.

  • @BenjaminBuch
    @BenjaminBuch Месяц назад +1

    The latest C++ standard is (20)23 not (19)98.

    • @cheesed_up
      @cheesed_up  Месяц назад +3

      How is it C++23 if we're in 2001? C++ this far ahead?

  • @PhthaloJohnson
    @PhthaloJohnson 19 дней назад

    So it's a proposal where C++ gets another language embedded into it. You of course have to opt in to use it and it's probably going to be a billion new keywords and syntax. Sounds familiar doesn't it. The problem with C++ is the fact that it's too overbloated. If you need the safety features, you really don't have an option but use Rust.

  • @maxoumimaro
    @maxoumimaro Месяц назад +39

    c++ dev here and I am not interested in those proposal.
    Also not Rust

    • @AA-qv7fb
      @AA-qv7fb Месяц назад

      its optional, i think.

    • @geek2145
      @geek2145 Месяц назад +3

      @@AA-qv7fb then just use smart pointers??

    • @AA-qv7fb
      @AA-qv7fb Месяц назад

      @@geek2145 smart pointers dont guarantee memory safety. I hate it too but you MUST evolve as anything that falls under regulation is starting to be written in rust due to memory safety. there there is a proposal that ensures memory safety and allows for incremental adoption it must be looked at. either way dont use it if you dont want to, it isnt a must according to the proposal.

    • @geek2145
      @geek2145 Месяц назад

      @@AA-qv7fb It can't be a must, because if it was it would break backwards compatibility, which is a requirement for c++. Let me be clear: I think safety by default is a great thing. If people or companies want that, then they shouldn't use c++. End of story. If you use a modern subset of c++, then memory errors will be extremely uncommon. The sanitizers provided by compilers can detect anything that slips between the cracks. The issue is that most devs do not do any of this. Most devs turn off compiler warnings that they find annoying. The issue isn't a lack of memory safety features in c++, there are more than enough. The issue is that developers don't use them. Because they don't care.

    • @geek2145
      @geek2145 Месяц назад +1

      @@AA-qv7fb The issue of memory errors is primarily a cultural one. The benefit of safety-by-default is that the language enforces a certain perspective. You are required to care. You can't add that to c++.

  • @loganhodgsn
    @loganhodgsn Месяц назад +13

    Yuck.

  • @Lifeismeaningless-mu2sz
    @Lifeismeaningless-mu2sz Месяц назад +14

    While they are it, can they please steal rust's cargo as well? pretty please?

    • @mehtubbhai9709
      @mehtubbhai9709 Месяц назад

      This

    • @fullaccess2645
      @fullaccess2645 Месяц назад +3

      still waiting for modules support

    • @uis246
      @uis246 Месяц назад +3

      Why? GNU Make or CMake+some make(incl. Ninja) for normal people. Vcpkg if you hate BSD and Linux users.

    • @uis246
      @uis246 Месяц назад +1

      Can rust steal Gentoo's portage, pretty please?

    • @LokiScarletWasHere
      @LokiScarletWasHere Месяц назад

      Cargo is such ass. No.

  • @James-l5s7k
    @James-l5s7k Месяц назад +42

    C++ has had safe pointers for a very long time. Rust is a cult.

    • @SamJamesCrawford
      @SamJamesCrawford Месяц назад +13

      The problem isn't that you can't write safe code, the problem (as I understand it) is that the compiler cannot verify that the code you wrote won't produce undefined behaviour. What I find incredible is the idea that compilers are even able to verify that code is safe at all

    • @jasonenns5076
      @jasonenns5076 Месяц назад +1

      @SamJamesCrawford that is not the job of the compiler... Nor it should be

    • @LWmusik
      @LWmusik Месяц назад +3

      I am still a C++ noob, but I have made at least one fairly big c++ project on my own. It was fairly easy, and I encountered very few issues. I am very curious about what all the "unsafe" talk even means? I only know modern c++, and have never used a raw pointer

    • @shrekeyes2410
      @shrekeyes2410 Месяц назад

      @@LWmusik No raw pointers? come on you gotta use *some*

    • @NJ-wb1cz
      @NJ-wb1cz Месяц назад

      Reference counting doesn't make pointers safe. I think cuktish behavior is when people proclaim something based on their beliefs about something without actually understanding it

  • @superblaubeere27
    @superblaubeere27 Месяц назад +2

    5:19
    Rust: Look what they need to mimic a fraction of our power

    • @cheesed_up
      @cheesed_up  Месяц назад

      Did you mean: "look how they massacred my boy"?

  • @abhijitleihaorambam3763
    @abhijitleihaorambam3763 Месяц назад

    the syntax bro

    • @cheesed_up
      @cheesed_up  Месяц назад

      To be fair, I used the worst example there is :D ... but yeah...

  • @timovandrey
    @timovandrey Месяц назад +1

    The biggest reason I dont use Rust is because of the ugly syntax. Call me stupid, but its just not fun.
    I was thrilled to hear that C++ is considering implementing safe code with a borrow checker.
    I was appaled by the syntax and hope they will change it, otherwise I also wont use it. Is it so hard to making an extension with not many deviations from the syntax? That make me sad.

    • @vimdiesel
      @vimdiesel Месяц назад

      Can you elaborate?
      I don't think rust is that much uglier than c++
      And the functional style looks much cleaner in rust

    • @timovandrey
      @timovandrey Месяц назад

      @@vimdiesel Yes this is 100% personal taste in syntax and honstely it is quite the stupid reason of me not using Rust because of the syntax. I just personally find it quite ugly and it feels like they tried to do everything different that you can do differently, other than curly braces, lol. I know other people like the syntax, and not using such a powerful language because of that is problably quite stupid in the long run, but right now I just feel its very ugly. And the same thing seems to be happening to "safe C++".

    • @danielt8880
      @danielt8880 Месяц назад +1

      IMOH Rust has the best syntax for it features. Other languages do not have many rust features, so the syntax was not needed. Now than C++ wants those rust features, what syntax did they come up with?

    • @timovandrey
      @timovandrey Месяц назад

      @@danielt8880 I can understand that, many do like it. I personally dont. But in the end, its a personal preference ans also a thing of what youre used to. After programming in Rust for a little while, youd probably get used to it and its not that horrendous anymore. I'm personally just someone who likes the C syntax the most (although it could also be better).

  • @RaymondT-ln6li
    @RaymondT-ln6li Месяц назад +2

    From Primeagen

  • @danielmilyutin9914
    @danielmilyutin9914 Месяц назад +5

    I'm C++ dev. That "safe" syntax looks yuck AF!
    I'm pretty sure it won't go to std like this.
    I'd use Circle instead. It can be tweaked to look like Rust.
    Actually using idiomatic C++ with RAII and value semantics should make it tones safer.
    Problem is that there are dev's who write it like C and do not understand how to do things right.
    Rust from other hand has restrictions which don't allow to do things the "wrong" way. That's its strength.
    From the other hand, it is Rust's weaknes when you just need to try things and not care about "righteousness".

    • @Onyx-it8gk
      @Onyx-it8gk Месяц назад

      @@danielmilyutin9914 This is Circle

    • @NotherPleb
      @NotherPleb Месяц назад +3

      Kind of disagree with the last part, you can do "easy mode" Rust, you move fast and don't spend time debugging. However, learning Rust to do the easy thing is the hard part.

    • @GuilhermeHCardozo
      @GuilhermeHCardozo Месяц назад +1

      ​@@NotherPlebyeah, and as someone that is learning Rust in the background, it would be reeeally cool to have a way to not care at all and just make a mvp

    • @danielmilyutin9914
      @danielmilyutin9914 Месяц назад

      @@NotherPleb When you need something fast and not really care that much about errors or design shifts all the time and you not sure how it will change or what right way is... Then Rust is not that good option if you're are not ultra Rust master and can refactor fast and have right intuition.
      And I as a C++ dev see, that it is mostly the question of language mastering. I'm doing some errors as any human being. But not that much. And design of code allows to do things pretty fast and pretty right. But it took 20 years to master.

    • @NotherPleb
      @NotherPleb Месяц назад

      @@GuilhermeHCardozo Use Box, slap "?" on results, clone when you fight the borrow checker, stick to data oriented designs and don't be afraid to slap an Arc. This is what I do for quick mvp, but you can only see these easy solutions if you already know Rust

  • @ИгорьСавенков-и3х
    @ИгорьСавенков-и3х Месяц назад +5

    This idea of ​​separating safe and unsafe code might be the best thing that ever happened to C++.
    I'm so tired of learning these ugly rules about using completely standard tools in a way that doesn't catch UB or an unexpected exception.
    The most frustrating thing in c++ to me is seeing people spend time learning some fundamentally broken tools, only to achieve much less by putting in even more effort

    • @geek2145
      @geek2145 Месяц назад

      If you're worried about UB, then run UBSan and ASan. That catches most mistakes.

    • @geek2145
      @geek2145 Месяц назад

      I also recommend using RAII, smart pointers, iterating with ranges, using variant instead of union, etc. All of these choices eliminate common sources of UB; mistakes are caught by the compiler.

    • @ИгорьСавенков-и3х
      @ИгорьСавенков-и3х Месяц назад +1

      @@geek2145 This is where the whole essence of the problem lies. I'm sure that for every C++ problem there is a separate tool that solves it.
      But these tools need to be:
      1) downloaded and attached to the project
      2) kept updated
      3) somehow dragged into CI
      4) on 90% duplicate the work that the compiler has already done
      *repeat for each project
      So no, the fact that there is a tool that solves the problem does not make it much easier. The problem is in the language. The language needs to be fixed

    • @ИгорьСавенков-и3х
      @ИгорьСавенков-и3х Месяц назад

      @@geek2145 Of course i know all of this recommendations. I only wish that they become default in some way

    • @geek2145
      @geek2145 Месяц назад

      @@ИгорьСавенков-и3х these sanitizers are built into gcc and clang. It's only an extra flag away.

  • @rcookman
    @rcookman Месяц назад +25

    I don't like it and if it gets standardized I won't be using it.

  • @rocapbg9518
    @rocapbg9518 Месяц назад +3

    Terrible idea. If you want safety, use Rust. The whole point of C++ is that it's not safe and it allows you to get in their and manually manipulate memory. If this gets adopted the language's whole purpose for existing disappears.

    • @8bitbug420
      @8bitbug420 Месяц назад

      Yeah, sometimes I want to blow my foot off

  • @NongBenz
    @NongBenz Месяц назад +3

    C++, just be yourself

  • @empathy_monster
    @empathy_monster Месяц назад +2

    I love Rust and actively promote it, but any professional software developer knows it's not as simple as "rewrite it in Rust", or " just begin new projects in Rust". Companies often have millions upon millions of dollars invested into their engineering team and software stack, and switching that over to a new language is time consuming and expensive, and many small companies don't have the resources to do so. This is why a safe C++ is so compelling, because it only takes minimal training for a C++ engineering team to get up to speed and you don't have to change your ecosystem and software stack. We should be devoted to safe code, not a particular programming language.

  • @seanbaxter1050
    @seanbaxter1050 Месяц назад +3

    Funny video!

  • @nolram
    @nolram Месяц назад

    Wow, they somehow made syntax WORSE than Rust!

  • @dario.lencina
    @dario.lencina Месяц назад +1

    It's about damn time! congrats!!

  • @mskiptr
    @mskiptr Месяц назад +1

    Rusts' borrow checking is a complex heuristic* though. It will be hard to come up with a sensible standard that's compatible with the myriad features C++ already has and that can be implemented for all the different compilers that exist.
    I think a better approach would be linear types + some simple reference borrowing. It would essentially codify RAII in the type system and ensure that resources always have exactly one owner.
    * It doesn't have false positives, but without a deep understanding of the compiler you can't fully predict what it will allow.

    • @mskiptr
      @mskiptr Месяц назад

      If you'd like to learn more about this, I highly recommend reading the article "Introducing Austral".
      (just beware some harsh C++ and Rust criticism)

    • @cheesed_up
      @cheesed_up  Месяц назад

      Sounds interesting, I'll check it out!

  • @andreaselfving2787
    @andreaselfving2787 Месяц назад +1

    I mean, sure the borrow checker seems nice, but any green-field cpp projects are quite easy to implement "safely". Ofc you CAN do.. fun stuff, but it's considered bad practice and basically prohibited by many coding rules.
    The real problem is with systems that use old compilers - usually embedded systems, with gcc 6 that doesnt even support cpp 11...

  • @aspiring_millionaire
    @aspiring_millionaire Месяц назад

    I like how the video on Theprimetime channel reacting this video of yours has more views and impressions than the original
    That guy didn't even include a link to your video because God forbid some of his viewers would come here and consume the content from its source, classic RUclips debauchery and it's so infuriating how some people can just steal away other's ingenuity and their ideas to make some low effort reaction videos

    • @wilsonwilson137
      @wilsonwilson137 Месяц назад

      He did include a link. That's how I got here.

    • @cheesed_up
      @cheesed_up  Месяц назад

      I know what you mean, however he did include a link and gave a shoutout! But yeah, youtube is weird :)

  • @geostorm8192
    @geostorm8192 Месяц назад +1

    Just use C# or Java at that point?

    • @cheesed_up
      @cheesed_up  Месяц назад +1

      I know what you are trying to say... but not a big fan of any of these two though :')-.

    • @geostorm8192
      @geostorm8192 Месяц назад +1

      @@cheesed_up **Sadge C# noise*

  • @dzkoen62
    @dzkoen62 Месяц назад

    cppfront > carbon

  • @Onyx-it8gk
    @Onyx-it8gk Месяц назад +7

    Sean has been working hard on this for years, and it's a viable option that's here now. No endless committee discussions while C++ goes the way of the dinosaurs. I'm all for it!!!

    • @cheesed_up
      @cheesed_up  Месяц назад +2

      Me too!!

    • @TheSulross
      @TheSulross Месяц назад +1

      one smart, determined guy is always better than a bureaucratic committee

    • @Onyx-it8gk
      @Onyx-it8gk Месяц назад

      @@TheSulross 💯

  • @mehtubbhai9709
    @mehtubbhai9709 Месяц назад +1

    It's about time

  • @DM-fw5su
    @DM-fw5su Месяц назад +1

    I like the work Sean has been doing to address the important aspects of C++ however the standards committee has other plans.
    The world will do better to debunk the C++ standard's committees dialog with government regulation bodies and show it up for what it is.
    This way C++ is outlawed sooner to make way for alternatives which may include 'circle' if the regulatory policy is written so.
    At this time the C++ committe only has hot air to show in this area, no code, no specification no compiler.
    Rust's problem is there is no committe, no alternative implementation, no standards specifications. Rust will do well to get its act together in this area if it wants to actually challenge and get regulatory status.
    Rust would do well to implement a small unix like OS entirely in rust to demonstrate to the world how it should be done. The learnings and feature advancement for rust makes this effort worth doing even if the kernel is not adopted my many.

  • @geek2145
    @geek2145 Месяц назад +2

    At this point, I'm not sure what people mean when they say "safe." Safety in any language, including rust, is not a guarantee. It's always a choice. Cpp gives you the choice to write memory safe code by leveraging the expressive type system. It's already opt-in. You can make the choice.

    • @Kupiakos42
      @Kupiakos42 Месяц назад

      What you mean by "safety" is not what Rust devs mean. It means "the program will fail to compile if it could possibly invoke undefined behavior" - memory safety is all about this compile-time check to ensure the type system won't fall apart.
      Memory safe languages like Rust and C# have this property, while C++ does not. In C++, it is trivial to accidentally cause a use-after-free or buffer overflow even when using the STL, and this can be seen in the number of memory safety vulnerabilities prevalent in all C++ codebases.

    • @geek2145
      @geek2145 Месяц назад

      @@Kupiakos42 Cpp has smart pointers, that's exactly what I mean.

    • @geek2145
      @geek2145 Месяц назад

      @@Kupiakos42 you can choose to use memory safe features of Cpp. Conversely, you can choose to write unsafe rust.

    • @pcallycat9043
      @pcallycat9043 Месяц назад

      @@Kupiakos42 The unfortunate thing is, Rust will fail to compile if you abuse memory, but this fact is so oversold that a great many people think it will fail to compile if you write code that results in undefined behaviour at all.. which is simply not that case. Sure, it is more difficult in rust to do a buffer overflow, but that doesnt mean you can't write a bug at all. People need to understand this.

    • @Kupiakos42
      @Kupiakos42 Месяц назад

      @@geek2145 Smart pointers make it easier to do memory management. It is the barest form of safety, and does not meet modern standards.

  • @gurupartapkhalsa6565
    @gurupartapkhalsa6565 Месяц назад +2

    This is called putting the cart before the horse. Hardware is inherently unsafe, the CPU is a machine, and it is capable of unsafe operation. A subset of the machine's capabilities will always be an inferior representation of the maximum. Even assembler is already a subset, because most of us acknowledge that the micro sub-operations such as fetch, cache, and the use of ALUs is well tuned for the machine specs as they are given to us. Making a declaration such as, "You are not allowed to address memory yourself," as a general rule, is simply asinine. You may believe in the future, but some of us are actually responsible for hardware, and someone needs to write your compiler.

    • @cheesed_up
      @cheesed_up  Месяц назад +1

      Very interesting take. I agree with you to some extent, however, I still think that putting safety constraints to a language is beneficial.
      If C++ is a language for this kind of constraints.. that's another topic :D

  • @bean_TM
    @bean_TM Месяц назад

    the proposed syntax looks so bad, id rather just use rust lmao

  • @tiranito2834
    @tiranito2834 Месяц назад +4

    with every passing day, there are more and more incentives for me to stay in pure C89 and reject all of humanity's lame attemps at "advancements" in programming languages...

    • @fullaccess2645
      @fullaccess2645 Месяц назад +5

      bruh

    • @arkeynserhayn8370
      @arkeynserhayn8370 Месяц назад

      ​@@fullaccess2645
      There is nothing, literally NOTHING that is computationally possible in other programming languages that you cannot do in C89.

    • @cheesed_up
      @cheesed_up  Месяц назад

      I know what you mean....

    • @NJ-wb1cz
      @NJ-wb1cz Месяц назад +1

      With every passing day, there are more and more incentives for me to shout at kids to get off my lawn. Getting old is not fun.

  • @vxvx6240
    @vxvx6240 Месяц назад

    it would be cool if they just would stop adding stuff to c++, but start deleting shit. I mainly write C++ and in my opinion the main problem is that its tooo fucking bloated. Noone uses every C++ function.

  • @DoDoENT
    @DoDoENT Месяц назад

    I think we'll sooner have LLM's capable of transforming large C++ codebases into Rust than this proposal getting accepted and implemented by compilers on all platforms.

  • @arl-t8d
    @arl-t8d Месяц назад +1

    "Memory safety is very important, always free your memory" 🤓
    Womp womp, skill issue

  • @everythingcouldbesimplify818
    @everythingcouldbesimplify818 Месяц назад +2

    Safe is boring

  • @zuulpongo
    @zuulpongo Месяц назад +4

    literally just write better code (this is not sarcasm)
    if you are in dire need of safety then don’t use c++

    • @NotherPleb
      @NotherPleb Месяц назад +3

      Critical systems and high performance systems had no safe alternative for decades and most of them need safety. The "skill issue" argument is so weak, with decades of training and best practices and still here we are, it's a "tool issue"

    • @geek2145
      @geek2145 Месяц назад +1

      @@NotherPleb there's no reason to mangle c++ with safety. Just use a different language. It's ok for c++ to be unsafe. It's ok for another language to be preferred when specific forms of safety need to be formally guaranteed.

    • @NotherPleb
      @NotherPleb Месяц назад +1

      @@geek2145 I agree! But for a long time there was only C++ even when safety is a requirement but the "just write better code" never scaled.

    • @geek2145
      @geek2145 Месяц назад

      @@NotherPleb that sounds like a management problem, because formal verification of software has existed for many years at this point. If you want true safety, use a language like Idris that acts as a proof checker. Worried about accidentally forgetting an edge case or making an infinite loop? The Curry-Howard correspondence is here to help.

  • @RoyaltyInTraining.
    @RoyaltyInTraining. Месяц назад

    C++ is slowly but surely turning into a clone of Rust with a worse standard library

    • @shrekeyes2410
      @shrekeyes2410 Месяц назад

      And a better non-standard library*

  • @santitabnavascues8673
    @santitabnavascues8673 Месяц назад

    I do not intend my software to run on the core systems of a nuclear submarine, but on a domestic computer, seriously, what is it with all the paranoia about memory safety? Git gud!

    • @levaniandgiorgi2358
      @levaniandgiorgi2358 Месяц назад +1

      Yea. It's not a big deal if domestic computers get hacked because of undefined behaviour

    • @santitabnavascues8673
      @santitabnavascues8673 Месяц назад

      @@levaniandgiorgi2358 who lets their program run with undefined behaviors? Not me.

  • @jimpal5119
    @jimpal5119 Месяц назад +5

    Writing "unsafe" code in C++ is literally a skill issue nowadays, literally. Just use standard containers + smart pointers and 99% of memory issues are fixed. There, I said it. Rust is for those who combine politics with programming. For some reason...

    • @Kupiakos42
      @Kupiakos42 Месяц назад +4

      You are empirically foolish: see the recent post "Eliminating Memory Safety Vulnerabilities at the Source" by the Android team. Stopping development of new C++ drastically reduces memory vulns.
      Anyone who claims to write perfect code all the time cannot be trusted.

    • @jimpal5119
      @jimpal5119 Месяц назад +1

      @Kupiakos42 Interesting post you provided. Nevertheless, I wholeheartedly stand by what I said. C++ already has everything needed to be perfectly memory safe. Moreover, don't you think that the cases when you need to write unsafe cpp code, say use raw pointers, pretty much coincide with when you would use unsafe in rust? Low-level and 100% safe just don't go hand in hand

  • @CXCubeHD
    @CXCubeHD Месяц назад

    Bad proposal at that point make a new language.

  • @DAV30371
    @DAV30371 Месяц назад +1

    Too much technical debt and nerfing its own capabilities by borrow checking with a price tag of ugly syntax. Time to consider zig/odin/c3.