Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!samsung!uunet!taumet!steve From: steve@taumet.com (Stephen Clamage) Newsgroups: comp.lang.c++ Subject: Re: Problems with typedef variable init'ing in c++ Message-ID: <783@taumet.com> Date: 26 Jun 91 17:16:21 GMT References: <2406@sun1.cs.nps.navy.mil> Distribution: comp Organization: Taumetric Corporation, San Diego Lines: 34 lombardo@sun1.cs.nps.navy.mil (charles lombardo) writes: |The problem is when I compile the same program slightly changed for the C++ |compiler. Namely: [crunched] |<> typedef float Matrix[4][4]; |<> extern void unit(Matrix); |<> main() |<> { |<> Matrix m; |<> unit(m); // line 7 |<> } |<> void unit(Matrix m) |<> { |<> static Matrix un = {1.0, 0.0, 0.0, 0.0, // line 15 |<> 0.0, 1.0, 0.0, 0.0, |<> 0.0, 0.0, 1.0, 0.0, |<> 0.0, 0.0, 0.0, 1.0 }; |<> ... |<> } |When I compile the above I get the following message: |<> "tmp2.c", line 7: warning: m used but not set |<> "tmp2.c", line 15: error: bad initializer type for un: double |<> ( float (*)[4] expected) |<> "tmp2.c", line 15: error: initializer list too long The first warning is because Cfront sees an uninitialized array passed (as a pointer) to a routine, and is trying to be helpful. The error messages are due to a bug in Cfront; your code is ok, although I would suggest using fully-bracketed initialization for clarity and ease of maintenance. -- Steve Clamage, TauMetric Corp, steve@taumet.com