M
MercyNews
Home
Back
Chromium Bans Specific C++ Features in Codebase
Technology

Chromium Bans Specific C++ Features in Codebase

Hacker News5h ago
3 min read
📋

Key Facts

  • ✓ The Chromium project has officially banned specific C++ features to maintain codebase stability and security across its massive browser ecosystem.
  • ✓ These restrictions are detailed in the project's official style guide, which serves as the definitive reference for all contributors.
  • ✓ Among the banned features are std::make_unique, std::make_shared, and std::regex due to compatibility and performance concerns.
  • ✓ The project provides Chromium-specific alternatives like base::MakeUnique to ensure consistent behavior across all supported platforms.
  • ✓ Code review processes now include automated checks that flag prohibited features before code is merged into the main branch.
  • ✓ The style guide is a living document that receives regular updates as C++ standards evolve and compiler support improves.

In This Article

  1. Codebase Evolution
  2. Banned Features List
  3. Rationale Behind Restrictions
  4. Impact on Development
  5. Future Considerations
  6. Key Takeaways

Codebase Evolution#

The Chromium project has established comprehensive guidelines banning specific C++ features to maintain stability across its massive codebase. These restrictions reflect the project's commitment to long-term maintainability and security.

As one of the largest open-source software projects in the world, Chromium's decisions impact millions of developers and users globally. The project's style guide now explicitly prohibits certain modern C++ additions that could introduce instability or security vulnerabilities.

The banned features include several modern C++ additions that could compromise the project's stability and security standards. This decision underscores the project's focus on code quality and cross-platform compatibility.

Banned Features List#

The Chromium project has identified several C++ features that are now prohibited within the codebase. These restrictions are detailed in the project's official style guide, which serves as the definitive reference for contributors.

Among the banned features are:

  • std::make_unique - Prohibited due to compatibility concerns
  • std::make_shared - Restricted for similar compatibility reasons
  • std::shared_ptr with arrays - Not allowed due to implementation inconsistencies
  • std::atomic with certain types - Limited to prevent undefined behavior
  • std::regex - Banned due to performance and compatibility issues

The project also restricts the use of std::filesystem and std::optional in certain contexts. These features, while part of modern C++ standards, are deemed unsuitable for Chromium's specific requirements.

The style guide emphasizes that these restrictions apply to the entire codebase, including all subprojects and dependencies. Contributors must adhere to these guidelines when submitting code for review.

Rationale Behind Restrictions#

The decision to ban these features stems from Chromium's unique position as a cross-platform project supporting multiple operating systems and architectures. The project must maintain compatibility with older compilers and libraries while ensuring consistent behavior across platforms.

Security considerations also play a crucial role in these restrictions. Some modern C++ features can introduce subtle bugs or undefined behavior that could be exploited. The project's maintainers prioritize security and reliability over convenience.

Performance is another critical factor. While some modern C++ features offer convenience, they may not meet Chromium's performance requirements. The project's massive scale means even minor performance regressions can have significant impact.

The Chromium team has found that certain features, despite being part of the C++ standard, have inconsistent implementations across different platforms. This inconsistency can lead to unexpected behavior and make debugging more difficult.

Impact on Development#

These restrictions significantly influence how developers write code for Chromium. Contributors must use alternative approaches that align with the project's guidelines while achieving the same functionality.

For example, instead of using std::make_unique, developers must use base::MakeUnique or similar Chromium-specific alternatives. These alternatives are carefully designed to work consistently across all supported platforms.

The project provides detailed documentation and examples for each restricted feature, helping developers understand the approved alternatives. This documentation is regularly updated as the project evolves.

Code review processes have been enhanced to catch violations of these restrictions automatically. The Chromium build system includes checks that flag prohibited features before code is merged into the main branch.

Future Considerations#

The Chromium project continuously evaluates its coding standards as C++ evolves. While certain features are currently banned, the project remains open to reconsidering these decisions as compiler support improves and standards mature.

The style guide is a living document that receives regular updates. Contributors are encouraged to provide feedback and suggest modifications based on real-world experience and changing requirements.

As the project grows and new C++ standards emerge, additional features may be added to the banned list, while others might become permissible under specific conditions. This dynamic approach ensures Chromium remains at the forefront of software engineering best practices.

The project's commitment to these standards demonstrates its dedication to producing high-quality, secure, and maintainable software that serves millions of users worldwide.

Key Takeaways#

The Chromium project's decision to ban specific C++ features represents a thoughtful approach to managing a massive, complex codebase. These restrictions prioritize stability, security, and maintainability over convenience.

Developers working with Chromium must adapt to these guidelines, using approved alternatives that ensure consistent behavior across platforms. While this may require additional effort, the benefits in code quality and reliability are substantial.

The project's evolving standards reflect the dynamic nature of software development, where best practices continuously improve to meet new challenges and opportunities.

Continue scrolling for more

AI Transforms Mathematical Research and Proofs
Technology

AI Transforms Mathematical Research and Proofs

Artificial intelligence is shifting from a promise to a reality in mathematics. Machine learning models are now generating original theorems, forcing a reevaluation of research and teaching methods.

Just now
4 min
363
Read Article
EquipmentShare Completes Public Market Debut
Technology

EquipmentShare Completes Public Market Debut

The construction technology platform, backed by Y Combinator, has successfully transitioned to a publicly traded company, opening a new chapter for the equipment rental market.

4h
5 min
1
Read Article
TikTok's New Privacy Policy: What Changes Now
Technology

TikTok's New Privacy Policy: What Changes Now

Following a shift in majority ownership, TikTok's updated privacy policy now collects more user data, including precise location. Explore the three biggest changes and what they mean for users.

4h
5 min
1
Read Article
DOJ Probes Rippling-Deel Corporate Spying Scandal
Crime

DOJ Probes Rippling-Deel Corporate Spying Scandal

The Department of Justice may be conducting a criminal investigation into the corporate espionage scandal between HR startups Rippling and Deel, marking the biggest drama between two HR startups ever.

5h
5 min
1
Read Article
Mastering Mental Models: A Guide to Better Thinking
Education

Mastering Mental Models: A Guide to Better Thinking

Mental models are frameworks for thinking that help simplify complex problems. By understanding key models like inversion and first principles, individuals can make better decisions and navigate uncertainty more effectively.

5h
5 min
1
Read Article
AI, Credit Rates, and Housing: Davos CEO Insights
Economics

AI, Credit Rates, and Housing: Davos CEO Insights

A look into key insights from the Club CEOs at this years World Economic Forum.

5h
5 min
1
Read Article
Neko: The Enduring Legacy of a Digital Pet
Technology

Neko: The Enduring Legacy of a Digital Pet

From its humble beginnings on Unix workstations to its viral spread across the early internet, Neko remains one of the most beloved software pets in history. This is the story of how a simple animation captured global attention.

5h
5 min
2
Read Article
Sonos Recertified: 20% Off Soundbars & Speakers
Technology

Sonos Recertified: 20% Off Soundbars & Speakers

Discover how to save up to 40% on premium Sonos audio gear. The recertified program offers like-new performance with a full warranty.

5h
5 min
1
Read Article
Xbox Exec Struggles to Explain Fable PS5 Day One Release
Technology

Xbox Exec Struggles to Explain Fable PS5 Day One Release

A recent interview revealed confusion within Xbox leadership regarding the platform strategy for upcoming titles, specifically why Fable will launch on PS5 while Forza Horizon 6 will not.

5h
5 min
1
Read Article
Tesla Robotaxi, Volvo EX60, Aptera: Weekly EV Roundup
Automotive

Tesla Robotaxi, Volvo EX60, Aptera: Weekly EV Roundup

This week's top stories in sustainable transport feature Tesla's controversial Robotaxi claims, the debut of the Volvo EX60, and Aptera's precarious financial situation.

5h
3 min
1
Read Article
🎉

You're all caught up!

Check back later for more stories

Back to Home