From: lonniem AT nol DOT net Newsgroups: comp.os.msdos.djgpp Subject: Re: Memory management in DJGPP Date: Sat, 04 Jan 1997 08:01:07 GMT Organization: Networks On-Line Lines: 56 Message-ID: <5akrpc$297$1@news.nol.net> References: <5ahrj3$crt$1 AT news DOT utdallas DOT edu> NNTP-Posting-Host: ip39-14.nol.net To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp rbrooks AT utdallas DOT edu (Rusty L Brooks) wrote: >I have a few questions about djgpp... since I am learning C++ from a >different C++ book, there is some difficulty... >First of all, gcc doesn't seem to handle the keyword far, as in: >char far *harf; >This was mentioned in the info libc.a help files... How can I maintain a >similar functionality? >Secondly, if I want to pass a memory value to a pointer, how do I go about >doing this? (Both for far pointers and near pointer) I get a warning >about casting harf (see above) to an int without a cast if I try something >like: >char *harf = 0x0013 or something similar. >Email replies appreciated, but I *do* read the group, so posting here is >ok too. Well for your casting woes try some code like this: char *harf = (char *) 0x0013; But I don't think this is what you want. This sets the ptr to point to the address 0x0013 and does not make that the value being pointed to. Try this: char *harf = malloc (1); *harf = 0x13; If this is not what you want well then I don't know what you do want. This sets the value being pointed to to 0x13. Also if you want to copy some code straight from a book that uses far/near pointers do this: #define far #define near This will take away the error messages but is not very good code. You don't need he whole far/near thing. It's was a kludge built into 16-bit code at a time when 64KB for code and 64KB for data was considered forward thinking. So just change this: char far* ptr; /* I've forgotten how to use the far keyword, Is this correct? */ into char* ptr; Lonnie McCullough lonniem AT mail DOT utexas DOT edu