Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!emory!stiatl!srchtec!johnb From: johnb@srchtec.UUCP (John Baldwin) Newsgroups: comp.lang.c Subject: Re: Novice MicroSoft C5.1 question Message-ID: <165@srchtec.UUCP> Date: 7 Aug 90 20:08:21 GMT References: <17179@haddock.ima.isc.com> <440@demott.COM> Organization: search technology, inc. Lines: 28 In article <440@demott.COM> kdq@demott.COM (Kevin D. Quitt) writes: [referring to printf() formatting in Microsoft C ver 5.10] > MSC's %p prints the pointer in the format SSSS:OOOO (segment/offset), with >%Np printing only the OOOO portion. Both forms expect a 32 bit pointer, >so non-32 bit pointers must be coerced by using the far keyword. A good way to make your code a little more portable (note the use of the relative term as opposed to the absolute) is to encapsulate the pointer type... If you have some oft-included header file (call it ), insert a typedef such as typedef void far * genptr; Choose the identifier to suit yourself and your coding style... then you can write printf("Address of foob is [%p] \n", (genptr)&foob); If you move to another implementation, you only have to change the typedef. [Obviously, in this instance, you'll have to do more than that, since there's not a '%p' format specifier in the ANSI printf()!!! Sorry. :-/ ] -- John T. Baldwin | johnb@srchtec.uucp Search Technology, Inc. | johnb%srchtec.uucp@mathcs.emory.edu standard disclaimer: | ...uunet!samsung!emory!stiatl!srchtec.. opinions and mistakes purely my own. | ...mailrus!gatech!stiatl!srchtec...