problems with the C parser
Guy Harris
guy at sun.uucp
Sat May 31 03:14:42 AEST 1986
> typedef union {
> int intfield; /* change the record name - keyword */
> struct bool{unsigned x[32]:1};
> } newtype;
>
>
> The C parser barfed all over this.
Well, actually, the parser had no trouble with it whatsoever. Some routines
that do semantic checking on declarations complained about it. There are
plenty of constructs in C which are syntactically valid but not legal C.
> I wanted an integer that I could index into by bit...
You can't. Read K&R again, only look at more than just the syntax
specifications. At the top of page 197:
...In all implementations, there are no arrays of fields...
Like it or not, that's the case. It may not be easy to convert your program
to use masks, but if you want to convert it to C you have no choice. There
*is* a Pascal on Suns, although I don't know if your program uses features
specific to VAX(/VMS, I presume) Pascal, which the Berkeley Pascal which Sun
offers probably doesn't have.
--
Guy Harris
{ihnp4, decvax, seismo, decwrl, ...}!sun!guy
guy at sun.arpa
More information about the Comp.lang.c
mailing list