Minimal druntime?

Ethan gooberman at gmail.com
Mon Jul 29 15:05:15 UTC 2019


On Sunday, 28 July 2019 at 17:44:38 UTC, Paulo Pinto wrote:
> So here goes another example, disabling exceptions and RTTI, 
> which is considered UB as per ISO C++ standard, given that the 
> standard assumes those features cannot be turned off and the 
> standard library (as per ISO C++ document) does require them 
> being present.
>
> Or constraing to subsets like Embedded C++ used by Apple's IO 
> Kit.
>
> Disabling exceptions and RTTI, coupled with an alternative 
> library like EASTL, or Embedded C++ existance, do follow the 
> same spirit as HPC# and -betterC.

Exceptions basically cost nothing on x64 these days. Structured 
exception handling hardware support, baybeeeeeee. Leave 
exceptions on. Either way, if you never try/throw/catch then the 
code isn't generated.

RTTI as well. Don't have virtuals in your objects? You won't get 
typeinfo code in your resulting binary. Don't dynamic cast? 
Compiler won't insert dynamic casts.

This is the "Pay as you go" thing we continually mention in here. 
Have all the features. Don't use them? Don't pay for them.

Embedded C++, HPC#, and -betterC do not follow this spirit. They 
are a restrictive subset that for all intents and purposes is a 
different language made after the fact. Try to use a feature of 
the full language? Nope, not supported. No pay as you go. Just a 
compiler error.

EASTL? It does not follow the "pay as you go" spirit. EASTL is a 
drop-in replacement for STL that followed the API as defined, but 
replaced the awful memory patterns and added extra methods in to 
it. Extra methods that showed up in C++ 11 standard. Why are you 
bringing up EASTL? That thing's ancient history and has known 
bugs that never got fixed. Had to patch some stuff myself many 
years ago for a project I was shipping.


More information about the Digitalmars-d mailing list