From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,f79df321ef1d2c00 X-Google-Attributes: gid1164f8,public X-Google-ArrivalTime: 1992-05-13 08:23:06 PST Newsgroups: comp.sys.dec Path: sparky!uunet!decwrl!deccrl!news.crl.dec.com!hollie.rdg.dec.com!decvax.dec.com!zk3.dec.com!evans From: evans@zk3.dec.com (Marc Evans) Subject: Re: DECs commitment to UNIX ? Message-ID: <1992May13.202838.3068@decvax.dec.com> Sender: usenet@decvax.dec.com (Usenet News System) Nntp-Posting-Host: ih82w8.zk3.dec.com Reply-To: evans@zk3.DEC.COM Organization: Digital Equipment Corporation - Nashua, NH References: <1992May11.172813.1@aud2.aud.auc.dk> <1992May12.203645.25485@decuac.dec.com> <902@niktow.canisius.edu> <1992May13.181504.23140@decuac.dec.com> Date: Wed, 13 May 1992 20:28:38 GMT In article <1992May13.181504.23140@decuac.dec.com>, mjr@hussar.dco.dec.com (Marcus J. "will do TCP/IP for food" Ranum) writes: |> pavlov@niktow.canisius.edu (Greg Pavlov) writes: |> > Do you have a similar facility for ULTRIX people ? How about some equivalent |> > (pseudo-equivalent) effort from DEC up front, whereby I could move a direc- |> > tory full of source from a MIPS/ULTRIX to an ALPHA/OSF 1 machine and execute |> > make with an "ULTRIX" flag ? Too much work ?? More than it took to build a |> > translator for VMS ??? |> |> Porting between OSF/Alpha and OSF/MIPS and ULTRIX/MIPS should be |> about as hard as recompiling applications was between a machine running |> 4.1 and 4.2, unless your code is assembler or something like that. The |> compilers are all there and they're the same frontends. What more do |> you need? For those of you that are would like to look through your code to see what (if any) gotcha's you may bump into in porting source code from Ultrix 4.2 to DEC OSF/1 for ALPHA, here is a list of issues to watch out for: By paying careful attention to data types you can make your code work on both 32 bit and 64 bit systems. C compiler data types and bit sizes are as follows: Mips 32 bit Alpha 64 bit C type Data Size Data Size ====== ========= ============ short 16 bits 16 bits int 32 bits 32 bits long 32 bits 64 bits * (ptr) 32 bits 64 bits Declare any variable that you want to be 32 bits in size, as an "int", not a "long". That way it will be 32 bits in size on both 32-bit mips systems and 64-bit Alpha systems. If a variable should be 32 bits in size on a 32-bit mips system and 64 bits in size on a 64-bit Alpha system, then declare it as a "long". Watch out for arguments to functions where the argument is not explicitly declared (and typed). You should explicitly declare the formal parameters to routines or their sizes may not match up with the caller (default is "int" which truncates 64-bit addresses). Remember that "register var" and "unsigned var" default to "int" (32-bits). Look at any variable declared "int". It may be used to hold an address! Sizeof (int) does not equal sizeof (char *) on Alpha. Look at any variable declared "long". If it must be 32 bits, then you have to change its type to "int". Constants are 32-bit quantities by default. Shift operations or bit operations on constants will give 32-bit results. If you want a 64-bit result you must follow the const with an "L", otherwise you get a 32-bit result. For example: long foo, bar; foo = 1L << bar; Using a "0" where you should use "NULL" means that you get a 32-bit const. On alpha that could mean 0 in the low 32 bits and garbage in the high 32 bits. Using "NULL" from stdio.h will get the correct value for mips and alpha. Modifying a "char" is NOT atomic on Alpha. You will get a load of 32 or 64 bits and then byte operations to extract, mask, and shift the byte, followed by a store of 32 or 64 bits. Bitfields declared as "int" on Alpha generate load/store long (32 bits) Bitfields declared as "long" on Alpha generate load/store quad (64 bits) Printf formats: %d and %x will print 32 bits worth of data. Use %ld and %lx to get 64 bits. - Marc