[chbot] Youtube : How NASA writes space-proof code

Charles Manning cdhmanning at gmail.com
Tue Aug 29 01:25:34 BST 2023


As a semi-regular supplier of code to NASA , I can assure you that this is
aspiration. not reality.

I think there is a middle path with heap usage which seems to be what most
organisations like NASA and Boeing etc really strive for and that is to
only use the heap for once-off allocations at start up. This allows the
creation of data structures at start up that were not known at compile time.
Some RTOSs have a nifty feature which allows malloc() to be turned off once
your program is up and running.

It is a bit easy to get draconian with rules. For example, recursion is
often the simplest and cleanest way to handle a problem and concerning a
recursive function to be non-recursive can often be hard and buggy - making
the code challenging to understand. Like with looping code, one solution is
to put an upper bound on recursive depth by passing a depth argument:

int recursive(int x, int depth)
{
  if (depth < 1)
     return -1; // ran out of depth
 else {
     depth = depth -1;
    return recursive(...,depth);
 }
}




On Tue, Aug 29, 2023 at 6:45 AM Mark Atherton <markaren1 at xtra.co.nz> wrote:

> https://www.youtube.com/watch?v=GWYhtksrmhE
>
> Finally someone who agrees with me that the heap is a heap-bad-thing :)
>
> Huge piles of common sense, and observations about static analysis.
>
> -Mark
>
> <hiding under bench>
>
>
>
> _______________________________________________
> Chchrobotics mailing list Chchrobotics at lists.ourshack.com
> https://lists.ourshack.com/mailman/listinfo/chchrobotics
> Mail Archives: http://lists.ourshack.com/pipermail/chchrobotics/
> Meetings usually 3rd Monday each month. See http://kiwibots.org for
> venue, directions and dates.
> When replying, please edit your Subject line to reflect new subjects.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ourshack.com/pipermail/chchrobotics/attachments/20230829/59f505e6/attachment-0001.html>


More information about the Chchrobotics mailing list