|
|
Log in / Subscribe / Register

Rust support hits linux-next

Rust support hits linux-next

Posted Mar 20, 2021 22:18 UTC (Sat) by adobriyan (guest, #30858)
In reply to: Rust support hits linux-next by stevenrwalter
Parent article: Rust support hits linux-next

> Are you saying you think there will be C++ in the kernel tree at some point?

I can't even push trivial stuff like renaming few "this" identifiers, so no.

> Also C++ is not source-compatible with C

C++ is maximally source compatible with C which automatically makes it the best
candidate for upgrading to a more capable programming language.

Trivial sources of source incompatibility come from casts and keywords
(people like plain "new" very much) but they can be scripted away.
I mean Googlers who posted Rust to linux-next are surely capable of it.

The most difficult sources of incompatibility don't come from C99 initialisers
(which can be rearranged) but from code like this:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/...

If someone knows how C++ people deal with macrology/features above, please tell me.

Modules also have a _lot_ of icky macros as does tracing. I don't even want to think about it.

The biggest problem so far is g++ being so eager to shift compile time initialisation
to runtime. So far all oopses but one in my little Linux++ project were caused by this:
empty system call table, empty paravirt ops and empty protection_map[] array.

That one different oops was int/long confusion in ERR_PTR rewrite.

C99 caluse shuffling is very dangerous when rebasing. It is so easy to mismerge stuff and
omit or double init. Double init is tolerable because g++ complains but omission is silent.


The LWN site is currently under high scraper load, so comment display has been suppressed for anonymous users. If you are a human, you may read the comments by clicking the button below:

Note: you can avoid this step in the future by logging into your LWN account.


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds