Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!cbosgd!gatech!seismo!topaz!brisco From: brisco@topaz.RUTGERS.EDU (T.p.) Newsgroups: net.lang.c Subject: problems with the C parser Message-ID: <5072@topaz.RUTGERS.EDU> Date: Thu, 29-May-86 17:44:01 EDT Article-I.D.: topaz.5072 Posted: Thu May 29 17:44:01 1986 Date-Received: Sat, 31-May-86 05:08:32 EDT Organization: Rutgers Univ., New Brunswick, N.J. Lines: 40 Keywords: bitfield,structure,'%&#@* I've been trying to translate a program written in Vax Pascal to C on our Suns. My problem arose when I was trying to translate a pascal variant record structure into a C union structure. The structure type (in pascal) looked as follows: (keep in mind - both were for 32 bit machines) newtype = record case selector of 0:(int: unsigned); 1:(bool: packed array [0..31] of boolean); end Which I had translated into C as: typedef union { int intfield; /* change the record name - keyword */ struct bool{unsigned x[32]:1}; } newtype; The C parser barfed all over this. I tried every combination of unsigned x:1[32], ..... that I could think of. Out of frustration I looked up the syntax of the declarations in K&R and found that the initial guess had been correct! I wanted an integer that I could index into by bit, so I could avoid using masks (which weren't going to be easily used due to the methodology of the original program). Am I going crazy or is our C parser brain-damaged? Can anyone else compile the above structure declaration? "Wah!" "No, no. It's 'Wah!'" "Wah!" "That's better!" tp.