[comp.lang.c] AIX C:constant expr in array decl breaks cc

johnny@edvvie.at (Johann Schweigl) (10/14/89)

Is there *formally* anything wrong with the following global declaration:

void (*foo[2][0 + 1 + 1 + 1])() = {
	{ fun1, fun2, fun3 },
	{ fun4, fun5, fun6 }
};

AIX C will not compile this but issue an error saying a '}' is missing on
both initialization lines.
The compiler gets confused by the '[0 + 1 + 1 + 1]'. Replace it by [3]
and everything works fine. The addition chain was generated by the 
the preprocessor.
Should it be like this, or is this an error?
-- 
This does not reflect the   | Johann  Schweigl | DOS?
opinions of my employer.    | johnny@edvvie.at | Kind of complicated
I am busy enough by talking |                  | bootstrap loader ...
about my own ...            |   EDVG  Vienna   | 

oleg@gryphon.COM (Oleg Kiselev) (10/19/89)

In article <184@eliza.edvvie.at> johnny@edvvie.at (Johann Schweigl) writes:
>Is there *formally* anything wrong with the following global declaration:
>void (*foo[2][0 + 1 + 1 + 1])() = {{ fun1, fun2, fun3 },{ fun4, fun5, fun6}};
>AIX C will not compile this but issue an error saying a '}' is missing on
>both initialization lines.

This works on AIX/370 and AIX/PS2.

-- 
			"No regrets, no apologies"   Ronald Reagan

Oleg Kiselev            ARPA: lcc.oleg@seas.ucla.edu, oleg@gryphon.COM
(213)337-5230           UUCP: [world]!{ucla-se|gryphon}!lcc!oleg

johnny@edvvie.at (Johann Schweigl) (10/21/89)

From article <21080@gryphon.COM>, by oleg@gryphon.COM (Oleg Kiselev):
> 			"No regrets, no apologies"   Ronald Reagan
				     ^^^^^^^^^^^^
Nevertheless, I apologize. I've messed up some #defines and found the
error a day after. Just I was not here to tell to the net.
BTW, you use AIX/370? On which machine? How is it?
-- 
This does not reflect the   | Johann  Schweigl | DOS?
opinions of my employer.    | johnny@edvvie.at | Kind of complicated
I am busy enough by talking |                  | bootstrap loader ...
about my own ...            |   EDVG  Vienna   | 

jackv@turnkey.gryphon.COM (Jack F. Vogel) (10/27/89)

In article <187@eliza.edvvie.at> johnny@edvvie.at (Johann Schweigl) writes:
>From article <21080@gryphon.COM>, by oleg@gryphon.COM (Oleg Kiselev):
>> 			"No regrets, no apologies"   Ronald Reagan
 				     ^^^^^^^^^^^^
>BTW, you use AIX/370? On which machine? How is it?

Oleg, like myself, works for Locus, we are the developers of AIX370 for
IBM. As for the machines, we have processors from the smallest 9370
through the 3090. As to how it is, that depends on the hardware you run
it on. I suggest you attend Unix Expo or one of the European shows and
see for yourself! In my opinion, AIX on a 3090-600 will blow the doors
off of just about any other Unix platform :-}.

Disclaimer: My opinions are not necessarily shared by Locus or IBM.

--
Jack F. Vogel			jackv@seas.ucla.edu
AIX Technical Support	              - or -
Locus Computing Corp.		jackv@ifs.umich.edu