[m-dev.] MR_warning()

Peter Ross petdr at cs.mu.OZ.AU
Thu Aug 13 09:20:01 AEST 1998


On 12-Aug-1998, Tyson Dowd <trd at cs.mu.OZ.AU> wrote:
> On 12-Aug-1998, Warwick Harvey <wharvey at cs.monash.edu.au> wrote:
> > Hi,
> > 
> > I had added an MR_warning() function (as per fjh's suggestion) for my 
> > changes to fix the MERCURY_OPTIONS problem, but since Zoltan's 
> > MERCURY_OPTIONS fix superseded mine before it was committed, this function 
> > is no longer necessary.  Still, it might be useful, so I ask if anybody 
> > thinks I should still commit (this part of) the change.
> > 
> > I also noted in an earlier post that fatal_error() did not accept a variable 
> > number of arguments, and offered to "fix" this too, but nobody commented, so 
> > I haven't done this (but will if somebody wants me to).
> > 
> 
> I suspect it is only not used because it didn't exist before now.
> I can think of a few good uses in the accurate GC.
> 
> If it isn't too much trouble to add a variable argument fatal_error I
> think this would be a good idea too.
> 
Here is the code that I copied out of 'Advanced Unix Programming'.
Warwick if you want to add it.

void fatal_error(const char *fmt, ...) 
{
    va_list ap;

    va_start(ap, fmt);

	fflush(stdout);		/* in case stdout and stderr are the same */

    vfprintf(stderr, fmt, ap);
    va_end(ap);

	fflush(NULL);		/* flushes all stdio output streams */

	exit(EXIT_FAILURE);
}



More information about the developers mailing list