FidoNet Echomail Archive
aust_c_here

<<< Previous Index Next >>>

From: Frank Adam
To: andrew clarke
Date: 1997-05-14 22:13:14
Subject: mk_fp

On May 13 05:48, 1997, andrew clarke of 3:635/728.4{at}fidonet wrote:
G'day andrew,

ac> Actually, for a bit of fun I tried compiling the following with 
ac> Borland C++ 3.1:

ac>   _far *myvar1;
ac>   *myvar2;

ac> It compiled cleanly - no errors or warnings!  Ridiculous.  It should 
ac> Strangely, Borland C++ refused to compile the following:
ac>   myvar3;
I've just tried this with BC2++..The tlot phickens
ANSI chokes on _far in all the tests.

When global:
C with BC extensions compiled the first 2, 3rd "typename missing".  
C++ gave type name missing on all three.

When declared in main():
C with BC exts gave "expression syntax" on #1, and undefed symbol on rest.
C++ gave "conflicting type mod" on the first, undefed symbol on the others.
  
ac> hadn't defined a type or storage class for all three variables, 
ac> '*'" with the second declaration, and compiled the third declaration 
ac> cleanly.  Is this compatibility or what?  :-)  (Not that it matters 
I think it's "what?". :-)

>> Ohkay :), what does the compiler has to do to a variable, when it 
>> encounters a _far in front of it ?

ac> Anyway, to get back to your question, the _far modifier forces the 
ac> compiler to treat the pointer as an offset into memory that may be 
ac> outside the current data segment.  (I think!)
Yep, looking at two variables in turbo debugger..
_near *myvar,p = ds:offs.  _far *myvar,p = seg:offs
The help on far says "it declares a pointer with two words of length".  
But, i believe a long* or void* is also 2 words near or far.

>> Yep, but without the FAR modifier. 
ac> Why?
Because BC2 with ANSI turned on will not accept FAR in any shape or form. 
Does yours ? I normally code with it turned on, but sometimes you need to
include something (like vidmgr) early on, so i have to switch it off, thus
won't be able to pick up any ANSI violations in the rest of the code.
It's just annoying that's all. I think i know most of the common ANSI
functions, it's the odd times when i have to shell out to look at the 
draft when it bugs me. 

 Regards, Frank

--- Msged 4.00
 * Origin: The ticking point, Melbourne, Australia. (3:635/728.21)
SEEN-BY: 50/99 633/267 270 635/728 670/218
@PATH: 635/728 633/267


<<< Previous Index Next >>>