|
|
|
|
|
by OneWingedShark
1877 days ago
|
|
>My comment for too many years is that C/C++ fails to deal with three issues: "How big is it", "Who owns it", and "Who locks it". Ada has is pretty good at dealing with all three of these, TBH. "How big is it" — Given by the 'Size attribute, and representation-clauses explicitly control record-layout. "Who owns it" — The declaring entity, which is why you can have dynamically-sized arrays without heap-allocation and "allow the scope to clean things up". "Who locks it" — a bit more convoluted than the above, but generally one of several options: (1) the Task / protected-object via entries; (2) the object itself, via controlled/limited_controlled inheritance; OR (3) the subprogram/compilation-unit via parameter-passing and/or interface-control (i.e. the only way to alter the interior-value is by some exported interface). |
|