Mail Archives: djgpp/1997/03/01/15:24:35

From: "Iain Buchanan" <Iain AT BuchananFamily DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: DJGPP Structs
Date: Sat, 01 Mar 1997 19:07:08 GMT
Message-ID: <01bc2673$a4dbe420$8e54dec2@satan>
Lines: 31
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I may be being extremely thick (I don't think so - but then I wouldn't :-),
I'm having this weird problem with DJGPP.  (I'm running it from RHIDE)  I
started off using large arrays, and found my programmes would crash when I
tried to access the data.  I've tried not using pointers, which still had
the same effect.  I tried stepping through each of the alloc-type commands,
until I finally got an error from "calloc", which I think is the problem. 

I've got a structure as follows:

struct defPt
    float x, y, z;
    int sx, sy;

And an array full of pointers to such structres:
defPt *View[25][25];

When I try and do this.... ("x" and "y" are of type int, and each go from
defPt *View[x][y] = calloc(1, sizeof(defPt));

I get an error message "Error: variable-sized object of type `defPt
*[1][1]' may not be initialized"  I used to use Turbo C and never had any
problems of this sort - surely the structure is pretty fixed size?  I've
checked through the documentation and could find nothing.  Is there any way
of making it a "fixed size" rather than "variable size"... 
Why the hell is it changing in size anyway!?

Thanks. Iain Buchanan

- Raw text -

  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019