18 ms·
Maybe because of this? > I think that the standard Rust API may simply not be acceptable inside the kernel, if it has similar behavior to the (completely broke
by joseluisq 6y ago
Maybe because of this?
> I think that the standard Rust API may simply not be acceptable
inside the kernel, if it has similar behavior to the (completely
broken) C++ "new" operator.
https://lkml.org/lkml/2021/4/14/1131 https://lkml.org/lkml/2021/4/14/1131
I'm not a C++ dev BTW, so this could need more details by someone with background for it.
- jeffbee 6y agoEh, that's just Linus continuing to demonstrate how little he knows about C++.
- sinsterizme 6y agoCould you expand? Maybe steel-man what you think his argument would be and your rebuttals?
- jeffbee 6y agoI can't really do a "steel man" rebuttal because over the years Linus has argued against a language he calls C++, but which is a made up language invented for the purpose of hating it. A straw man, if you will. It is difficult and frankly not worth the trouble to try to rebut an argument that has never risen above the level of "crap", "broken", and "bullshit". In the particular case of operator new, it's clear from his cumulative statements that Linus is unaware that the programmer provides global ::new, and can make it do whatever the hell he wants it to do. You can also just forbid it and use placement new everywhere.
- ironman1478 6y agoTo be fair, I think most C++ programmers are unaware of replacing global ::new and most don't know about placement new either (from what I've observed). I think lots of people who write library style code do (whether it be for boost, stl, or in their company) but outside of that most C++ devs are not library style devs and are a bit out of the loop on these topics. Also, I agree with what you said early about RAII solving entire classes of issues that C (and C++ without RAII) has.
- steerablesafe 5y agoMost C programmers are not kernel developers either.
- ibotty 5y agoHow can you catch allocation failure from ::new? Is it possible without exceptions (which have some other problems in kernel space)?
- steerablesafe 5y agoOne can use ::new(std::nothrow), which selects the non-throwing allocation function. Returns nullptr on failure.
- ssokolow 5y agoThey've already responded that their use of "alloc", which is designed more for userspace, is just a temporary thing that they plan to replace before any serious submissions. See also https://github.com/Rust-for-Linux/linux/issues/2#issuecomment-821143720 https://github.com/Rust-for-Linux/linux/issues/2#issuecommen...