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

Chromium Bans Specific C++ Features in Codebase

Hacker News11h 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
366
Read Article
Google's School Strategy: Building Lifelong Brand Loyalty
Technology

Google's School Strategy: Building Lifelong Brand Loyalty

A child safety lawsuit has unveiled internal Google documents suggesting the company's strategy to cultivate brand loyalty by investing in schools and onboarding children into its ecosystem.

6h
5 min
2
Read Article
Nvidia's Arm Laptops Challenge Intel Inside
Technology

Nvidia's Arm Laptops Challenge Intel Inside

A leak reveals Lenovo has built six laptops powered by Nvidia's upcoming N1 and N1X processors, marking a significant shift in the Windows laptop landscape.

7h
5 min
2
Read Article
Open-Source Self-Driving Expands to 325 Car Models
Technology

Open-Source Self-Driving Expands to 325 Car Models

A significant update to an open-source self-driving platform has expanded compatibility to 325 vehicle models from 27 different automotive brands, marking a major step in accessible autonomous technology.

7h
5 min
2
Read Article
Ford Enters Electric Semi Market with 2026 F-Line E
Automotive

Ford Enters Electric Semi Market with 2026 F-Line E

Ford is entering the medium- and heavy-duty electric vehicle market with its new F-Line E semi truck, set to launch in Westerm Europe this summer.

7h
5 min
1
Read Article
ChargePoint Expands EV Charging to Rental Car Lots
Technology

ChargePoint Expands EV Charging to Rental Car Lots

ChargePoint is adding public EV chargers at rental car locations in Wisconsin, a small but notable expansion of charging access at airports and neighborhood branches in Appleton and Madison.

8h
5 min
3
Read Article
Minnesota Activist Releases Arrest Video After White House Manipula...
Politics

Minnesota Activist Releases Arrest Video After White House Manipula...

A Minnesota activist has released the full, unedited video of his arrest at a church, countering a manipulated version previously shared by the White House. The raw footage offers a starkly different narrative of the confrontation.

8h
5 min
5
Read Article
Yann LeCun Launches AMI Labs: Inside the New AI Startup
Technology

Yann LeCun Launches AMI Labs: Inside the New AI Startup

The AI pioneer has left Meta to found AMI Labs, a new venture focused on developing advanced artificial intelligence systems. The startup has already captured significant industry interest.

8h
5 min
3
Read Article
Ubisoft Developers Express Deep Frustration Over Internal Issues
Technology

Ubisoft Developers Express Deep Frustration Over Internal Issues

Multiple developers at the gaming giant have voiced profound disappointment, with one stating it's the most embarrassed they've felt working anywhere. The sentiment points to deeper, systemic issues.

8h
5 min
2
Read Article
Over 600 Minnesota Businesses Close in ICE Protest
Politics

Over 600 Minnesota Businesses Close in ICE Protest

In a massive coordinated protest, over 600 Minnesota businesses shut down operations to demonstrate against ICE activities, highlighting the deep economic and social impacts of immigration enforcement.

8h
5 min
2
Read Article
🎉

You're all caught up!

Check back later for more stories

Back to Home