🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.djgpp
Article #1

Declaring arrays inside generic function

#1
From: Michael E. Wesolowski
Date: Tue, 28 Nov 1995 03:37
23 lines
1576 bytes
I don't know if this is a problem with gcc, the DOS port of gcc, or 
something (i.e., not a bug) in the implementation that I don't know 
about. I'm using the DOS port of gcc (djgpp), v1.12m4. This is equivalent 
ot gcc 2.6.3, if I remember correctly.

I have a generic function which has as one of its input parameters an int 
which identifies an array size. Within the function, I attempt to declare 
an array of int's:

int item_count [array_size];

where array_size is the input parameter. When I look at the array in the 
debugger (gdb) however, what i see is an array of int pointers (I think) 
- something like int (*) [60000] (the 60000 is approximate). If I 
explicitly declare the array as, for example, item_count [10], I get the 
expected array of 10, uninitialized ints. SO, what's the problem?

If it's something in the ANSI standard, I'd appreciate the paragraph 
reference as well as a simple description of what's going on. Thanks.

---------------------------------------------------------------------

Michael Wesolowski (mewesolo@freenet.calgary.ab.ca)
Technical Details
Message-ID: <Pine.A32.3.91.951127202934.29743A-100000@srv1.freenet.calgary.ab.ca>
Path: arc1-ca.pugleaf.net!srv1.freenet.calgary.ab.ca!mewesolo

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!srv1.freenet.calgary.ab.ca!mewesolo
From: "Michael E. Wesolowski" <mewesolo@freenet.calgary.ab.ca>
Newsgroups: comp.os.msdos.djgpp,comp.lang.c++
Subject: Declaring arrays inside generic function
Date: Mon, 27 Nov 1995 20:37:32 -0700
Organization: Calgary Free-Net
Message-ID: <Pine.A32.3.91.951127202934.29743A-100000@srv1.freenet.calgary.ab.ca>
NNTP-Posting-Host: mewesolo@srv1.freenet.calgary.ab.ca
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII