Typical security issues in C++: why the GC isn't your enemy

youSureAboutThat youSureAboutThat at gmail.com
Mon Dec 12 05:13:16 UTC 2022


On Monday, 12 December 2022 at 03:48:26 UTC, Walter Bright wrote:
> On 12/9/2022 2:39 PM, H. S. Teoh wrote:
>> According to `dmd -h`, they are disabled everywhere except 
>> @safe code.
>
> Safe code is where bounds checking is needed.

True, it's needed in @safe, but possibly warranted nonetheless in 
@system as well.

Of course bounds checking at runtime will always degrade 
performance.

So the question for @system code - which presumably is being 
written and optimised for performance (over safety), is whether 
the developer(s) can be bothered measuring the performace impact 
of run-time bounds checks, and then, if they can be bothered, 
subsequently deciding whether that performace impact is 
sufficient to do away with the memory related safety guarantees 
provided by those run-time bounds checks.

My guess is developers writing @system code will not even bother 
to measure - and thus the cycle goes: on and on and on..



More information about the Digitalmars-d mailing list