Mail Archives: djgpp/1992/08/12/06:03:10

Date: Wed, 12 Aug 92 11:50:25 +0200
From: kunst AT prl DOT philips DOT nl (Pieter Kunst)
Subject: atexit returns garbage
Reply-To: kunst AT prl DOT philips DOT nl
To: djgpp AT sun DOT soe DOT clarkson DOT edu, dj AT ctron DOT com

Hello DJ,

I just installed DJGPP 1.07 (from 1.05). As some of the mailing list 
readers wrote me, this version resolves the MS-DOS wild card problem 
I asked about earlier ('globbing').

(1)  Also clock() is now implemented.  (K&R, 2nd ed., p.255)
     However, the following line seems to be missing from <time.h>:
     #define CLOCKS_PER_SEC  1000000

(2)  The atexit() function (K&R, 2nd ed., p.253) returns garbage 
     instead of the expected 0 if successful. (I think this was not 
     the case in version 1.05 of DJGPP.)

	#include <stdio.h>
	#include <stdlib.h>
	void myexit(void)
	  printf ("Inside myexit...\n");
	  int n;
	  n = atexit (myexit);
	  printf ("atexit returns: %d\n", n);
	  printf ("Before exit...\n");
	  exit (0);
	  printf ("After exit...\n");   /* never reached */


      atexit returns: 4202516
      Before exit...
      Inside myexit...
    This is an unhappy situation for me, because I make a lot of 
    use of the following construct:
       if (atexit(myexit)) warn ("atexit failed...");

Kind regards.

Pieter Kunst
kunst AT prl DOT philips DOT nl
The best way to predict the future is to invent it - Alan McKay (Apple)

- Raw text -

  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019