Mail Archives: djgpp/1995/02/06/20:20:48
First off, I don't recommend using the farns* functions inside other
functions. It's not safe. You don't know what someone else might
have done with the segment registers between calls.
> #include <sys/farptr.h>
>
> class scrlword;
> class scraddr;
>
> class scraddr {
> public:
> short i;
> scrlword operator*();
> inline scraddr operator=(scraddr z) {
> i=z.i;
> return *this;
> };
> };
>
> class scrlword {
> public:
> short i;
> inline short() {
> return _farnspeekw(0xb8000+i);
> };
> inline scrlword(short&s) { /* 1 */
> _farnspokew(0xb8000+i,s);
> };
> };
>
> inline scrlword scraddr::operator*()
> {
> scrlword s; /* 2 */
> s.i=i;
> return s;
> };
In line /* 1 */ above (code reformatted for readability), you declare
that the class scrlword has a single constructor that takes an
argument.
In line /* 2 */ above, you create an object of that type, which
implies that you call the constructor, but you do not provide
arguments to match the one constructor you have. The other
constructor gcc lists is the default copy constructor, which you don't
have either.
You need to either explicitely provide an argument-less constructor,
or pass a short when you declare the object.
- Raw text -