• Chromium प्रोजेक्ट आधुनिक C++ standard features के उपयोग-क्षेत्र और प्रतिबंधित आइटम्स को स्पष्ट रूप से परिभाषित करता है, ताकि code consistency और security बनी रहे
  • C++11~C++23 तक हर standard के लिए allowed, banned और under review (TBD) स्थिति अलग-अलग तय की गई है, और Abseil library पर भी यही मानदंड लागू होते हैं
  • प्रतिबंधित फीचर्स में std::shared_ptr, std::function, std::regex, std::filesystem, std::byte, char8_t, modules आदि शामिल हैं
  • अनुमत फीचर्स में concepts, spaceship operator, designated initializer, std::to_underlying, std::ranges algorithms आदि शामिल हैं
  • यह guide Chromium और उसके सभी sub-projects पर लागू होती है, और code stability व build compatibility सुनिश्चित करने के लिए एक मुख्य मानदंड की तरह काम करती है

Chromium की Modern C++ उपयोग नीति

  • Chromium नए C++ standard को तुरंत adopt नहीं करता, बल्कि toolchain support पर्याप्त रूप से सुनिश्चित होने के बाद उसे ‘initially supported’ स्थिति देता है
    • इसके बाद हर feature को allowed, banned, या under review (TBD) में वर्गीकृत किया जाता है
  • नए features की स्थिति बदलने का प्रस्ताव cxx@chromium.org mailing list के जरिए दिया जा सकता है
  • initial support के 2 साल बाद, स्पष्ट review के जरिए feature को allowed या banned सूची में ले जाया जाता है

C++11 के प्रतिबंधित फीचर्स

  • language features: inline namespace, long long, user-defined literals
  • library features: <chrono>, <regex>, <random> engine, <exception>, <ratio>, <thread> आदि
    • exception पूरी तरह disabled हैं, और केवल noexcept की अनुमति है
    • std::bind, std::function, std::shared_ptr, std::weak_ptr की जगह base::Bind, base::Callback, base::RefCounted का उपयोग किया जाता है

C++17 के प्रतिबंधित फीचर्स

  • UTF-8 character literal (u8) प्रतिबंधित है, क्योंकि char8_t के साथ compatibility समस्या है
  • library में प्रतिबंधित आइटम्स:
    • special math functions, parallel algorithms, std::any, std::byte, std::filesystem, std::pmr memory resources आदि
    • parallel algorithms पर libc++ support नहीं है और Chrome के threading model से टकराव की आशंका के कारण इन्हें प्रतिबंधित किया गया है

C++20 के अनुमत और प्रतिबंधित फीचर्स

  • अनुमत language features:
    • concepts, consteval, designated initializers, spaceship operator, [[likely]], range-for initialization syntax
  • अनुमत library features:
    • <bit>, <compare>, <concepts>, <numbers>, std::erase_if, std::ranges::subrange, std::to_underlying आदि
  • प्रतिबंधित फीचर्स:
    • char8_t, modules, [[no_unique_address]], std::bit_cast, <span>, std::bind_front, std::ranges::view_interface
  • under review (TBD): coroutine, <format>, <source_location>, std::u8string

C++23 के अनुमत और समीक्षााधीन फीचर्स

  • अनुमत language features: #elifdef, if consteval, static operator
  • अनुमत library features: std::byteswap, std::basic_string::contains, std::to_underlying, std::ranges expanded algorithms
  • समीक्षााधीन फीचर्स: std::expected, std::mdspan, std::generator, std::stacktrace, std::print, [[assume]], #warning आदि

Abseil library नीति

  • प्रतिबंधित Abseil components:
    • absl::any, absl::optional, absl::StatusOr, absl::Span, absl::FunctionRef, absl::Mutex, absl::Time, absl::btree_* आदि
    • इनमें से अधिकतर को Chromium के base namespace implementations से replace किया जाता है (base::span, base::expected, base::Bind आदि)
  • under review (TBD): absl::linked_hash_set, absl::linked_hash_map

समग्र अर्थ

  • Chromium standard C++ features को बिना शर्त स्वीकार नहीं करता, बल्कि build stability, security, performance और code consistency के आधार पर चुनिंदा रूप से अपनाता है
  • अधिकांश प्रतिबंधित फीचर्स के पीछे duplicate implementations (base::) या toolchain·ABI compatibility issues कारण हैं
  • यह guide Chromium ecosystem के लिए C++ code quality management standard की तरह काम करती है, और open source collaboration में एक जरूरी reference document है

अभी कोई टिप्पणी नहीं है.

अभी कोई टिप्पणी नहीं है.