[m-dev.] Tool for generating DU types in C

Ralph Becket rafe at csse.unimelb.edu.au
Mon Mar 22 12:16:14 AEDT 2010


Julien Fischer, Monday, 22 March 2010:
> 
> On Sun, 21 Mar 2010, Ralph Becket wrote:
> 
> >     a_b_tree
> >     branch(a_b_tree l, a_b_tree r)
> >     {
> >         struct a_b_tree_branch *this =
> >         (struct a_b_tree_branch *)
> >             malloc(sizeof(struct a_b_tree_branch));
> >         if (this == NULL) {
> >             perror("a_b_tree:branch");
> >             exit(1);
> >         }
> >         this->_tag = _a_b_tree_branch_tag;
> >         this->l = l;
> >         this->r = r;
> >         if (l == NULL || r == NULL) {
> >             fprintf(stderr, "a_b_tree: branch cannot have NULL arguments.\n");
> >         }
> 
> Aren't you missing a call to exit() there?  Presumably you shouldn't
> keep executing if a branch does have a NULL argument?

That's a bug in the .du file: the NULL tests there are user-provided
code.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at csse.unimelb.edu.au
Administrative Queries: owner-mercury-developers at csse.unimelb.edu.au
Subscriptions:          mercury-developers-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the developers mailing list