delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/07/16/08:47:32

From: kagel AT quasar DOT bloomberg DOT com
Date: Tue, 16 Jul 1996 08:40:06 -0400
Message-Id: <9607161240.AA02686@quasar.bloomberg.com >
To: juanjo AT jet DOT es
Cc: djgpp AT delorie DOT com
In-Reply-To: <31EB52DA.63C1@jet.es> (message from Juanjo Erauskin on Tue, 16 Jul 1996 10:29:14 +0200)
Subject: Re: Function conversion
Reply-To: kagel AT dg1 DOT bloomberg DOT com

   From: Juanjo Erauskin <juanjo AT jet DOT es>
   Date: Tue, 16 Jul 1996 10:29:14 +0200

	   What is the conversion of Microsoft C, FP_OFF(), FP_SEG() and 
   segread() functions in DJGPP ?

DJGPP is a 32bit flat memory model compiler.  You do not need these functions.
It is best to '#if defined()' their use away be replacing the code with 32bit
code.  But if you MUST maintain 16bit'ish code just decide whether the 32bit
address is to be a segment with a zero offset or an offset from a zero base
segment and code them as either:

#define FP_SEG( p ) p
#define FP_OFF( p ) 0

-OR-

#define FP_SEG( p ) 0
#define FP_OFF( p ) p

I don't remember what segread does, having strictly avoided Microsoft compiler
products for 10 of the last 14 years, but you get the idea.  Maybe someone more
familiar with MS "C" can answer or you could post it's functionality.

Again, the best course is to rewrite the code or, at least, to make compilation
compiler dependent if you must maintain source compatibility.  As I told
someone else a few weeks ago: You don't need these macros, you don't want these
macros.  Your code will be cleaner, and more easily maintained, if you get rid
of the 16bit'isms.  [He descends from his soapbox and carries it away.  ;) ]

-- 
Art S. Kagel, kagel AT quasar DOT bloomberg DOT com

A proverb is no proverb to you 'till life has illustrated it.  -- John Keats

- Raw text -


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