delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/06/14/03:30:31

Date: Mon, 14 Jun 1999 10:27:46 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: djgpp AT delorie DOT com
Subject: Re: Pointers, functions and memory
In-Reply-To: <929307582.390.40@news.remarQ.com>
Message-ID: <Pine.SUN.3.91.990614102718.21962J-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

Scott Brown <skb AT xmission DOT removethis DOT com> wrote in message
news:37606970 DOT 14959285 AT news DOT xmission DOT com...

> ((int(*)(int, char *))p3)(99, "done");
>
> Is this a safe thing to do?  Can a data pointer be safely interchanged
> with a function pointer?

It is okay to do that, but you need to know what you are doing and
check your code very carefully to make sure you don't accidentally
``call'' a data pointer.  When the compiler sees a type cast, it turns
off many (if not all) of its diagnostics warnings, assuming that you
know what you are doing, so you are on your own.

> If it's okay under DOS/DJGPP, will it still work after I port my
> program to Unix/GCC?

It should work in any C compiler.

> Second question:  When my DJGPP program executes a non-DJGPP DOS
> program as a child process, is the child's conventional memory space
> affected by my program's memory allocations?  Is DJGPP's conventional
> memory footprint consistent and/or predictable?

These questions are answered in section 15.8 of the DJGPP FAQ list.
If something there isn't clear enough, please ask specific questions.

> Are there any ways I can minimize that footprint for the duration of
> the system/spawn call?

Not really.  However, given that the conventional mmeory footprint is
usually extremely small, do you have any real problems?  If so, please
describe them.

- Raw text -


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