C is Brittle D is Plastic
Walter Bright
newshound2 at digitalmars.com
Tue Apr 7 05:20:38 UTC 2026
On 4/5/2026 3:28 AM, Derek Fawcus wrote:
> 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.
I've never seen it used. It's too awkward.
> 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.
Static analysis cannot reliably detect array overflows. It's that old halting
problem.
> Rewriting in a different language is a much more risky task, and generally an
> impossible sell to management.
AI has proven to be useful in translating code to a different language.
More information about the Digitalmars-d
mailing list