From: horst DOT kraemer AT snafu DOT de (Horst Kraemer) Newsgroups: comp.os.msdos.djgpp Subject: Re: A bug Date: Thu, 05 Aug 1999 03:38:15 GMT Organization: [Posted via] Interactive Networx Lines: 55 Message-ID: <37a89db7.28823536@news.snafu.de> References: <199907290753 DOT JAA19712 AT aurora DOT put DOT poznan DOT pl> NNTP-Posting-Host: n244-169.berlin.snafu.de X-Newsreader: Forte Free Agent 1.11/32.235 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com On Thu, 29 Jul 1999 09:53:21 +0200 (MET DST), Wieslaw Bela wrote: > I want to report a bug that I've found while making a project in > DJGPP. I don't know where is the problem, but I've tried many > things, including changing the order of variables, size of arrays, their > names (I also tried to compile on two different machines), and the effect > is always the same: the memory for (static) array "wyglad" isn't > allocated (when I debug it, size of this array is 0), although no bug is > reported during the make (when I changed the program and allocated > memory using new operator, everything was OK). I've got the same problem > with COLOR_MAP structure from allegro, so it seems that DJGPP doesn't > allocate memory for some structures. Here is a short example of how > does it work: > > const MaxBok = 10, MaxWys = 20; > const IlWierzch = 4, IlScian = 3; > struct punkt2D > { > int x, y; > }; > typedef punkt2D sciana [IlWierzch]; > > sciana wyglad [MaxBok + 1] [MaxBok + 1] [MaxWys + 1] [IlScian]; > > int main (void) > { > return 0; > } No bug. Why should the compiler allocate something for the birds which is not used in the program ? The program does nothing except returning 0 to the host environment. For this effect it doesn't need to allocate an array. Change your program to int main () { wyglad[0][0][0][0] = wyglad[0][0][0][1] return 0; } and your 'wyglad' _will_ be allocated. Regards Horst