C is Brittle D is Plastic

Derek Fawcus dfawcus+dlang at employees.org
Sun Apr 5 10:28:42 UTC 2026


On Sunday, 5 April 2026 at 00:15:33 UTC, Cid Lib wrote:
>
> Fixing 'pointer decay' with fat pointers is like upgrading the 
> locks on your front door while the house is built on a shifting 
> swamp.

It has always been possible to avoid pointer decay for fixed size 
buffers, it is just that that the syntax is ugly, and the use 
cases are limited.

Having been assigned to work on some old code, adjusting APIs to 
use that form (or where difficult the newer "char buf[static X]" 
combined with static analysis (and warning flags) has been an 
easy improvement.

Rewriting in a different language is a much more risky task, and 
generally an impossible sell to management.

DF


More information about the Digitalmars-d mailing list