Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!steinmetz!davidsen From: davidsen@steinmetz.steinmetz.UUCP (William E. Davidsen Jr) Newsgroups: comp.lang.c,comp.sys.ibm.pc Subject: Re: MSC 4.0 "far" question Message-ID: <7298@steinmetz.steinmetz.UUCP> Date: Thu, 10-Sep-87 09:55:28 EDT Article-I.D.: steinmet.7298 Posted: Thu Sep 10 09:55:28 1987 Date-Received: Sat, 12-Sep-87 10:22:38 EDT References: <1510@killer.UUCP> Reply-To: davidsen@crdos1.UUCP (bill davidsen) Organization: General Electric CRD, Schenectady, NY Lines: 41 Keywords: I'm probably being silly, but... Xref: mnetor comp.lang.c:4264 comp.sys.ibm.pc:7647 In article <1510@killer.UUCP> tad@killer.UUCP (Tad Marko) writes: |I'm probably being totally silly, but can I do this in small model programs |to save DGROUP space as described in MS Language Newsletter Vol.2 No.8 |(BYTE August 1987, page 67). | |----- |char far fararray[256]; /* See the pun? */ | |main() |{ | stuff... | | printf("%s\n", fararray); |} | |--------------- |What do I need to do to make this work in small model, if possible? If |not, what exactly do they expect you to be doing in the MS Newsletter? The printf routine is expecting a near pointer in this model, and the only *reliable* way to fix that is to move the data to a local array. far arrays work reasonably well with pointer arithmetic and subscripts, but far addresses passed into library routines don't work. I would also advise you to declare the value as a pointer and then get a value from halloc at runtime. This will improve portability to future versions. # char far *foo, *halloc(); # (stuff) # foo = halloc((long)256); /* i may be remembering the name halloc # incorrectly, it's the far hugh allocate in any case */ | |Thanks, |Tad I hope I helped. -- bill davidsen (wedu@ge-crd.arpa) {uunet | philabs | seismo}!steinmetz!crdos1!davidsen "Stupidity, like virtue, is its own reward" -me