Path: utzoo!mnetor!uunet!husc6!mit-eddie!ll-xn!adelie!axiom!insyte!jad From: jad@insyte.uucp (Jill Diewald) Newsgroups: comp.unix.questions Subject: Portability Question Message-ID: <122@insyte.uucp> Date: 14 Dec 87 23:24:35 GMT Organization: Innovative Systems (INSYTE), Newton, MA Lines: 37 Keywords: Portable VAX VMS vs HPUX c Hi- We are porting our product from the HP running HPUX c, to the VAX running VMS c. The following simple program produces different answers on the two machines. We want to know which is right (if either) so we can report it as a bug to the correct source. Preferably, we want to know which the new ANSI standard thinks is correct. Thanks Jill Diewald Innovative Systems Techniques Newton, Ma .../harvard/axiom/insyte/jad /*--------------------------------------------------------------------- * The VAX distinguishes between signed and unsigned bit fields, the * HP does not. The following program will display '1' on the HP and * '-1' on the VAX. (To insure portability, all bit fields should be * declared as 'unsigned int'!) *--------------------------------------------------------------------- */ #includemain () { struct { int x : 1; } foo; foo.x = 1; printf ("%d\n", foo.x); }