Originally posted by ssokolow
View Post
Announcement
Collapse
No announcement yet.
A 2024 Discussion Whether To Convert The Linux Kernel From C To Modern C++
Collapse
X
-
Originally posted by cj.wijtmans View Post
thats why i LIKE C++. And that is why it would be relatively easy to switch to the C++ compiler and then make new code use C++ features. Or even cuse objects where before it was just a typedef. Also allowing "unsafe" code makes custom allocators easy to implement.
Last edited by darkonix; 16 January 2024, 05:14 PM.
Comment
-
Originally posted by cj.wijtmans View Post
i dont care whatsoever. unsafe keyword is for babbies that dont know how to code.
-- Almost literally the kind of thing programmers and users of other languages with unstructured goto said when faced with languages that forbid using goto to jump into the middle of a function, bypassing its beginning.
- Likes 2
Comment
-
Originally posted by darkonix View Post
Note that it is not trivial to compile the Linux Kernel with C++ (see https://lore.kernel.org/lkml/7e72d2e...d0bf0076@p183/). Also many features of C++ will not be accepted easily or at all. And until compilers allow to selectively turn off features (profiles?) It will be difficult to guarantee developers are using whatever accepted subset is allowed.
Originally posted by ssokolow View Post
"i dont care whatsoever. C is for babbies that dont know how to code."
-- Almost literally the kind of thing programmers and users of other languages with unstructured goto said when faced with languages that forbid using goto to jump into the middle of a function, bypassing its beginning.
not sure what the argument here is when C allows and even relies on goto when dealing with signals and what rust will have to deal with in the current unix-like ecosystems. And no this is not an argument in defense of it.Last edited by cj.wijtmans; 17 January 2024, 09:42 AM.
Comment
-
Originally posted by cj.wijtmans View Postnot sure what the argument here is when C allows and even relies on goto when dealing with signals and what rust will have to deal with in the current unix-like ecosystems. And no this is not an argument in defense of it.
...but, before structured programming became the norm, programmers had a very similar "If you can't keep this straight in your head, you're not a real programmer" attitude toward making your code as spaghetti as possible in the name of optimization.
Comment
-
Originally posted by ssokolow View Post
C allows structured goto. You can't use goto to jump to an arbitrary other location in the program, bypassing the beginning of a function to start in its middle, like you can with assembly language or pre-structured higher-level languages. If you try, GCC will refuse to compile it.
...but, before structured programming became the norm, programmers had a very similar "If you can't keep this straight in your head, you're not a real programmer" attitude toward making your code as spaghetti as possible in the name of optimization.
Comment
-
Originally posted by cj.wijtmans View PostNobody said its trivial or easy, not sure why this strawman/red herring keeps popping up.
Originally posted by cj.wijtmans View PostAnd about this "accepted subset", that is how every maintained code works, especially linux, regarding coding style, standard and whatnot. So again a nonargument.
Comment
-
Originally posted by cj.wijtmans View Post
and i fail to see how this analogy applies to a unsafe keyword. i know what is unsafe or undefined behaviour and why it exists and yes the compiler could give a warning or even an error with compile flags so what is the issue.
In Rust's case, it's that you can't have the compiler check the code for correctness to the level Rust allows, with the level of reliability Rust allows, unless you have a safe-by-default paradigm and a safe/unsafe split (similar to how const-by-default with a mut keyword more properly accounts for actual in-the-wild human behaviour) because we've already seen people reject things like splint's annotations and safer dialects of C again and again... Rust addresses that by disguising writing those annotations for existing C or C++ code as "writing Rust bindings".
In essence, it's an exercise in using language design to steering human behaviour and a key part of what makes it work is that people like you find it too much bother to join in and interfere with the development of the language, preferring to stay on languages like C and C++ and complain about how your comfort zone is eroding and "why won't people just see how bad the new thing is?"
Comment
-
Originally posted by ssokolow View Post
It's always the same reason transitions to languages happen... compatibility with the existing ecosystem prevents the earlier language from retrofitting the desired new features.
Comment
-
Originally posted by cj.wijtmans View Post
this has not at all stopped C++ from innovating, if anything they didnt keep up with the C standard that well(in terms of C compatability). C++ had to adopt some C functionality and it should keep that way. most of C++ benefits come from metaprogramming, RAII OOP, exceptions and STL which all of it exist perfectly fine on top of C coding.
If C++ were to adopt Rust's key innovations in an effective way, it'd be "Rust, but with syntax less optimized for the new usage patterns" because it would have to break compatibility with old C++ codebases (unless wrapped in annotations to add the new information the compiler needs... A.K.A. bindings) to do it.Last edited by ssokolow; 24 January 2024, 02:04 AM.
Comment
Comment