logoalt Hacker News

Banned C++ features in Chromium

115 pointsby szmarczakyesterday at 8:27 PM94 commentsview on HN

Comments

Night_Thastusyesterday at 9:41 PM

Nothing particularly notable here. A lot of it seems to be 'We have something in-house designed for our use cases, use that instead of the standard lib equivalent'.

The rest looks very reasonable, like avoiding locale-hell.

Some of it is likely options that sand rough edges off of the standard lib, which is reasonable.

show 3 replies
bengoodgertoday at 12:39 AM

Seeing the comments here talking about ancient codebases got me wistful for when Chromium was new and everything seemed possible.

That triggered a flash of feeling extremely old realizing we broke ground on this codebase 20 years ago this year!

dnmcyesterday at 11:06 PM

There are yet more interesting docs in the parent directory :)

https://chromium.googlesource.com/chromium/src/+/main/styleg...

lateforworkyesterday at 11:47 PM

You almost never see a list of banned Java features (or even banned C# features). On the other hand any serious C++ development team is going to have a list of banned features. Java eliminated the features that you would want to ban.

show 6 replies
Tempest1981yesterday at 11:16 PM

Where does it list the preferred alternatives to banned features?

For example:

> The <filesystem> header, which does not have sufficient support for testing, and suffers from inherent security vulnerabilities.

show 3 replies
ddtayloryesterday at 9:54 PM

Exceptions are banned, but an exception is made for Windows.

show 1 reply
bfrogtoday at 1:27 AM

This list is longer than the features in all of C I feel like at first glance. Wow that is overwhelming.

ameliusyesterday at 11:15 PM

Is there a way to make this formal, like in the code, making the compiler complain when you try to use these features?

show 4 replies
weinzierltoday at 12:38 AM

I'd curious about the banned Rust features. Surely, Rust has at lot fewer foot guns, but it isn't that there aren't any.

show 2 replies
dfajgljsldkjagyesterday at 9:48 PM

The banned list proves that context matters more than having the newest tools. These features work well for small apps but they cause problems in a project this size.

show 2 replies
kazinatortoday at 12:53 AM

Good call on those u8"..." literals.

Source code should all be UTF-8 natively, letting you directly write UTF-8 text between quotes.

Exactly their rationale.

These literals are a solution in search of a problem ... which is real but has a much better solution.

nixosbestostoday at 1:43 AM

Rust is too complicated!!11 Ooops wrong thread.

jesse__yesterday at 10:09 PM

It's remarkable to me how many codebases ban exceptions and yet, somehow, people still insist they're good.

show 5 replies
einpoklumyesterday at 11:51 PM

Since Chromium stopped allowing manifest-v2 extensions, i.e. significantly crippled what extensions can do and made it impossible to use some key extensions like uBlock Origin, I've decided to avoid it.

Anyway, about these C++ conventions - to each software house its own I guess. I don't think banning exceptions altogether is appropriate; and I don't see the great benefit of using abseil (but feel free to convince me it's really that good.)

show 1 reply
WalterBrightyesterday at 10:49 PM

Modules are banned - they should have just copied D modules.

grougnaxyesterday at 11:28 PM

C++ itself should be forever banned