[comp.lang.c++] typdef int *

jeffb@grace.cs.washington.edu (Jeff Bowden) (02/11/89)

The subject says it all.  Cfront 1.1 rejects it as being a syntax error.  Gcc
g++ and pcc all think it's just peachy.  Any suggestions on how to make
CC happy (i.e. alternative declarations that mean the same thing)?

ark@alice.UUCP (Andrew Koenig) (02/11/89)

C++ generally does not allow extra parentheses in declarations.
Since [] binds more tightly than unaries,

	typedef int *(il[8][8]);

is equivalent to

	typedef int *il[8][8];

which I expect your cfront will accept.
-- 
				--Andrew Koenig
				  ark@europa.att.com

maung@elbereth.rutgers.edu (tin maung) (02/14/89)

<8901@alice.UUCP> gives

> 	typedef int *il[8][8];

as a substitute for

        typedef int *(il[8][8]);

That should work here.
But if you can't remember a precedence rule,
or if the situation is tougher, you might try the
following approach:

     typedef int *intptr;
     typedef intptr il[8][8];

It's messy, but it works.
--------------------------------
Barry Schwartz (...!rutgers!cdspr!bbs), thanks to Tin Maung