Our great sponsors
-
libCat
🐈⬛ A runtime for C++26 w/out libC or POSIX. Smaller binaries, only arena allocators, SIMD, stronger type safety than STL, and value-based errors!
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
-
AECforWebAssembly
A port of ArithmeticExpressionCompiler from x86 to WebAssembly, so that the programs written in the language can run in a browser. The compiler has been rewritten from JavaScript into C++.
Exception is part of std, (ex. in std::vector constructor). Exceptions should be used in the "everything is lost" situation. In a situation where exceptions are not activated, the overhead is close to zero. For the rest there is expected (https://github.com/TartanLlama/expected)
Placement new is not really a problem, because the factory methods produce a pr-value, and unwrapping the optional should have && and const&& overloads, so assuming that there is a move-constructor or a private shallow copy-constructor then this still works. Placement new (or construct_at) would be used inside of an optional, for instance. Example
C++ is similar to C in that there are multiple "styles" of use that vary from project to project. Other, usually newer languages (C#, Python, Rust, etc) tend to have a stronger sense of what idioms should be used. Whereas, for instance, some C++ projects (like some GUI libraries and game/graphics engines) will partially/entirely replace the STL (and older ones may have been around before C++ had a standard library aside from C's), or forbid the use of certain C++ features (example).
In my AEC-to-WebAssembly compiler, I am using custom exception types for internal compiler errors: CorruptCompilationContext, InvalidTypenameException and NotImplementedException. I am handling them in main.