[ back to toc ]

c/c++ syntax

Date: 2002/01/29 08:53

Q:
I am compiling a very old (about 10 yrs old) program, which is actually a
driver for a data acquisition card. The driver source code is supplied by
the manufacturer and is said to be a combination of Pascal and C in some
way.

The source code has lines of code as follows:

unsigned far cdecl GEMem(void);

unsigned far cdecl XEMem(unsigned, unsigned, unsigned);

void far cdecl fast_s_chan(int, int, int, int far *);

0void far cdecl fast_127_chan(int, int, int, int far *);

void far cdecl fast_m_chan(int, int far *, int, int far *

When I compile with VISUAL C++ 6.0 the above lines results in the
following errors:

pp(180) : error C4226: nonstandard extension used : 'far' is an obsolete
keyword
C:\pc_30.cpp(182) : error C4226: nonstandard extension used : 'far' is an
obsolete keyword
C:\pc_30.cpp(184) : error C4226: nonstandard extension used : 'far' is an
obsolete keyword
C:\pc_30.cpp(184) : error C4226: nonstandard extension used : 'far' is an
obsolete keyword

Can you please tell me what is the significant of the “far” keyword or
explain what each line is meant to do.
Can I just delete the keyword “far “? Because when I delete it the program
compile under VISUAL C++ without the above errors

Regards
>From *NAME-DELETED*

A:
Far pointers come for the ancient ages when DOS and Win16 was in place.
Old Intel processors used narrow address bus and memory addressing was
done in two steps using segment registers and offset registers. There was
a "near" call and "far" call.

A near call occupied only 16 bit address and was in the same segment
(64KB) as the caller. Far call needed 16bit segment and 16bit offset.

In modern windows the addressing is flat 32bit, thus there is no need for
near and far pointers. All pointers are "far".

Regards,
Peter

[ back to toc ]