Path: chuka.playstation.co.uk!news From: Nick Slaven Newsgroups: scee.yaroze.freetalk.english Subject: Re: I need help too... Date: Sat, 02 May 1998 09:48:54 +0100 Organization: PlayStation Net Yaroze (SCEE) Lines: 62 Message-ID: <354ADDF3.4B8071A@compuserve.com> References: <354a9b68.19948433@www.netyaroze-europe.com> NNTP-Posting-Host: ld12-141.lon.compuserve.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.04 [en] (Win95; I) I think, dare I say it, that the compiler is wrong. For some reason it is ignoring the const declaration, maybe the GNU people have some reason for doing this, or maybe its a bug, or maybe there is a IWantYouToIgnoreConsts flag that is on by default in GNU. However, the code compiles fine in CodeWarrior and Borland C++ 5 so GNU you're the odd one out here. At first I thought that your types (TMD_Header, etc) had some run time expressions, but even putting const int SizeWorkSpace=10; does not compile. my advice - go with another #define cheers Nick Slaven Robert Swan wrote: > Im sure this is sooooo dumb, yet... > > Im trying to get the code to allow me to dynamically create tmds to > work. there seems to be just one problem though, and seeing as my > knowledge of ansi c and error messages is terrible, i was wondering if > anyone could help me overcome this compile time error i get. > > // **** Global variables > #define SizeTMD_Header (sizeof(TMD_Header)) > #define SizeTMD_Object (sizeof(TMD_Object)) > #define SizePRIM_Header (sizeof(PRIM_Header)) > #define SizeTMD_3_Flat (sizeof(TMD_3_Flat)) > > #define SizeVertex (sizeof(Vertex)) > #define SizeNormal (sizeof(Normal)) > #define SizePadding (20) > > const int SizeWorkSpace = > SizeTMD_Header + > SizeTMD_Object + > SizePRIM_Header + > SizeTMD_3_Flat + > (SizeVertex*4) + > (SizeNormal*4) + > SizePadding; > > static u_char WorkSpace[SizeWorkSpace]; // error here > > but this leads to the error as follows - > > variable-size type declared outside of any function > > I think I know what this means, but surely it shouldnt happen when Im > defining the size of the array based on a const? Im sure this is a > really simple problem, and I hope you can help! > > Robert Swan > rs108@mdx.ac.uk > http://www.netyaroze-europe.com/~middex2