delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/09/06:26:46

Date: Thu, 9 Apr 1998 13:24:37 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Will Rose <cwr AT cts DOT com>
cc: djgpp AT delorie DOT com
Subject: Re: Executing a program and obtaining its return value
In-Reply-To: <892102406.261004@optional.cts.com>
Message-ID: <Pine.SUN.3.91.980409132200.24173K-100000@is>
MIME-Version: 1.0

On 9 Apr 1998, Will Rose wrote:

> Whether system() returns a valid exit code is implementation defined;

That's what ANSI Standard says.  However, in the case of DJGPP, the 
implementation-defined behavior is *always* to return the exit code of 
the subsidiary program.

> You can certainly return a pointer, but what use would it be?  Pointers
> point to objects in a given processes' address space, and (with rare
> exceptions) won't mean anything to another process.  What would another
> process do with the pointer when it had got it?  And if the process
> has exited, where would the pointer point to anyway?

However, a parent program can meaningfully pass a pointer to a child 
program, provided that the child can access that portion of memory.  
That's how DJGPP programs pass long command lines between them.

- Raw text -


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