Better branding of -betterC

norm norm.rowtree at gmail.com
Tue Nov 3 10:14:25 UTC 2020


On Tuesday, 3 November 2020 at 07:29:52 UTC, Walter Bright wrote:
> On 11/2/2020 10:04 PM, norm wrote:
>> Every C++ embedded project I have ever seen has exceptions 
>> turned off.
>
> I actually looked at implementing EH for DOS C++ programs. It's 
> technically possible, but quite useless, as the necessary EH 
> code would consume the entire 640Kb of memory :-/

Yep, binary bloat is the biggest factor but also the 
unpredictability of the unwind. If resources run out during the 
unwind the system can and does unexpected things. If you're lucky 
you get a bus error.

With exceptions turned off the most common approach is a brutal 
but effective one. An ENFORCE function, usually called ASSERT, 
that takes a predicate. If the predicate fails it writes the 
failure reason to an area in flash that persists across boot then 
sits in a while loop waiting for the HW watchdog to kick in. Any 
pending failure reason is reported on the next boot.

Cheers,
Norm


More information about the Digitalmars-d mailing list