profiles icon indicating copy to clipboard operation
profiles copied to clipboard

profiles-wishlist

Open PooyaEimandar opened this issue 1 year ago • 5 comments

Hello @BjarneStroustrup

First of all, thank you for your groundbreaking contributions to the development of the C++ programming language. It is truly appreciated. Based on your talk, I assume that in the future, we will have something similar to Rust with the Clippy feature for C++, but this time, these profiles will have specific target use cases in various fields of the industry. So to answer your questions:

  • Set of profiles – what profiles do we need? which should be part of an initial set? Which should be standardized? Which should be defined as unions of other profiles?

My proposal is

1 - CppCore: This profile checks for adherence to the C++ Core Guidelines. 2 - Deprecated: This profile prevents the use of deprecated code and libraries. 4- Style: This profile checks for naming conventions and code style guidelines based on clang-format (e.g Google, LLVM and etc.) 4- Memory: This profile checks for:

  • Memory usage analysis
  • Compile-time allocation and deallocation tracking
  • Compile time Tracing object reference chains
  • Compile-time and run-time memory leak detection
  • Memory usage patterns

5- Embedded: Based on the Memory profile, this profile is customized for resource-constrained embedded systems (e.g., NO_STD_LIB). 6- Performance: this profile is tuned for performance and fearless parallelism. 7- Realtime: Based on Performance profile, this profile tuned for real time applications that require high computing capabilities from both the CPU and GPU. 8- Safety-Critical: Based on the Embedded and Realtime profiles, this profile is optimized for critical systems.

  • How do we specify a profile? As a set of guarantees; not, simply as a set of detailed rules. We need examples of profiles: both the set of guarantees and an initial set of detailed rules for delivering those guarantees.

We should start by establishing a set of guarantees and then provide specific details for each category. The initial set may encompass, but is not limited to, three key areas: Performance, Safety and Behavioral. Then ask what type of behavioral, safety or performance this profile aims to achieve. (e.g sometimes, we use unsafe code for performance, and other times, we need to add many verification and assembly codes to keep things safe).

  • The Core Guidelines has been our initial proving ground for rules for good (and often safe C++ code). We need more rules and rules taking advantage of C++20 and C++23. Individual suggestions can be made directly on the CG GitHub, but larger sets of suggestions and suggestions directly related to profiles belong here.

Agreed, I'm pretty sure C++20 Concepts is a valuable asset!

  • Comments/analysis on how various compilers could accommodate profiles.

The biggest problem we currently face is the divergence of compiler strategies. Each one has taken a different approach for memory safety. In my opinion, the only way to overcome this situation is to bring the static analysis, Lifetime annotations for C++, Microsoft GSL and others as the part of the language itself.

  • Comments/analysis on how various static analyzers could accommodate profiles.

We encounter a similar issue in the field of static analysis. For instance, we have several static analyzers, but the majority of them are not cross-platform. The Clang Static Analyzer represents our best chance.

  • Names of individuals and groups working on profiles and similar projects.

I would love to collaborate in this endeavor, but apart from the ISO members I don't know of any individuals or groups at the moment.

PooyaEimandar avatar Oct 23 '23 08:10 PooyaEimandar