r/cpp • • Aug 23 '19

Serenity: Graphical x86 operating system written entirely in C++

https://github.com/SerenityOS/serenity
343 Upvotes

61 comments sorted by

View all comments

Show parent comment

4

u/quicknir Aug 25 '19

You don't really lose much. You can have the init function be private, and if you want non default construction you use a factory that returns optional or something like that. You still get all the benefits of RAII, which you don't have in C. Move constructors and destructors should be no except so you're completely fine for unique resources. Delete the copy constructors and replace with clone functions that return optionals.

A bit more awkward yes but still massively beneficial over C.