delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/10/20/16:15:16

From: Nate Eldredge <neldredge AT hmc DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Typedefs for Dummies
Date: 20 Oct 2000 13:06:59 -0700
Organization: InterWorld Communications
Lines: 33
Sender: nate AT mercury DOT st DOT hmc DOT edu
Message-ID: <83g0lrs2e4.fsf@mercury.st.hmc.edu>
References: <39f05c8e DOT 3570804 AT netnews DOT att DOT net>
NNTP-Posting-Host: mercury.st.hmc.edu
Mime-Version: 1.0
X-Trace: nntp1.interworld.net 972072419 14278 134.173.57.219 (20 Oct 2000 20:06:59 GMT)
X-Complaints-To: usenet AT news DOT interworld DOT net
NNTP-Posting-Date: Fri, 20 Oct 2000 20:06:59 +0000 (UTC)
User-Agent: Gnus/5.0802 (Gnus v5.8.2) Emacs/20.5
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

see DOT sig AT for DOT email DOT address (Peter B. Steiger) writes:

> Can somebody translate this to English for me?  I grew up on Pascal
> and went from there to Clipper where I earn a living, so I have never
> been able to wrap my mind around C syntax.  This week I'm trying to
> write a C module to link in with my Clipper program, and the Clipper
> headers required for such a project make some definitions that were
> apparently written for the Evil Empire's compiler; gcc gags on them
> with "Parse error before *".  Here's an example:
> 
> typedef unsigned char BYTE;
> typedef BYTE far *BYTEP;
> typedef BYTEP PBYTE;
> 
> What the heck does that mean, and why doesn't gcc like it?

Essentially, it makes the type `BYTE' as another name for `unsigned
char'; the type `BYTEP' meaning far pointer to BYTE; and PBYTE meaning
the same as BYTEP.  Poor style, IMHO; I'd rather see just BYTE, and
the rest written BYTE * where necessary.

Anyway, the reason the compiler doesn't like it is `far'.  This is a
relic of 16-bit DOS compilers.  The FAQ explains how to handle it, but
the easiest thing to try is just to get rid of it; try

#define far /* nothing */

before including the header, and see if that works.

-- 

Nate Eldredge
neldredge AT hmc DOT edu

- Raw text -


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