From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,11ab432aa0ee5f7e X-Google-Attributes: gidfee84,public X-Google-ArrivalTime: 1994-09-13 10:44:09 PST Newsgroups: comp.unix.osf.osf1 Path: bga.com!news.sprintlink.net!redstone.interpath.net!ddsw1!news.kei.com!MathWorks.Com!news.duke.edu!news-feed-1.peachnet.edu!paperboy.wellfleet.com!noc.near.net!atria.com!jtk From: jtk@atria.com (John Kohl) Subject: Re: comp.unix.ultrix DEC OSF/1 Frequently Asked Questions In-Reply-To: treese@OpenMarket.com's message of 13 Sep 1994 02:08:02 GMT Message-ID: Followup-To: comp.unix.osf.osf1 Sender: news@atria.com Nntp-Posting-Host: banana.atria.com Organization: Atria Software, Inc. References: Date: Tue, 13 Sep 1994 14:04:33 GMT >>>>> "FAQ" == treese writes: In article treese@OpenMarket.com writes: FAQ> Archive-name: dec-faq/osf1 FAQ> Last-modified: Sat Sep 10 18:22:32 EDT 1994 FAQ> Version: 1.7 FAQ> ============================================== FAQ> N6. **NEW** What's wrong with xdr_long in the OSF/1 XDR routines? FAQ> xdr_long is used for sending signed 32-bit values and cannot send FAQ> 0xFFFFFFFF. xdr_ulong should be used instead. For 64-bit integer FAQ> values, use xdr_hyper. See the manual pages for more details. FAQ> [Curtis Keller, curtis@kinesix.com] FAQ> ============================================== This is slightly misleading. xdr_long() can send -1, which in 32 bits is 0xffffffff. xdr_long() does range checking, insuring that the top 33 bits of its 64-bit argument are all ones or all zeroes. If this is not the case, then the signed long integer is beyond the range of representation within a signed 32-bit value, and xdr_long() rightly fails. xdr_u_long() [note typo above!] insures that the top 32 bits of its 64-bit argument are all zero. If this is not the case, then the unsigned long integer is beyond ... blah blah. So, the upshot is: If you're using signed values, use xdr_long(), and DON'T use unsigned constants like 0xffffffff to set variables. If you're using unsigned values, use xdr_u_long(). In both cases, make sure you're within range for 32-bits, if you want to interoperate with 32-bit machines using native data types. Steve Lionel, if you're reading this, feel free to incorporate this update into the next FAQ. -- John Kohl or working for but not representing: Atria Software --------- What are you pretending not to know?