www.digitalmars.com         C & C++   DMDScript  

D - DLI or DMD bug: static array of structs

reply Russ Lewis <spamhole-2001-07-16 deming-os.org> writes:
I ran across this in DLI 0.1.1, I have no clue whether it's a DLI or DMD
bug.

The following code will crash dli with the message
"machine-i386.cpp(1885): struct, dumping core..."

struct foo {}
foo[100] bar;
int main() {
        return 0;
}

However, if I make 'bar' a dynamic array and allocate it in main with
"bar = new foo[100];" then it works fine.

--
The Villagers are Online! http://villagersonline.com

.[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ]
.[ (a version.of(English).(precise.more)) is(possible) ]
?[ you want.to(help(develop(it))) ]
Nov 01 2002
parent Burton Radons <loth users.sourceforge.net> writes:
Russ Lewis wrote:
 I ran across this in DLI 0.1.1, I have no clue whether it's a DLI or DMD
 bug.
 
 The following code will crash dli with the message
 "machine-i386.cpp(1885): struct, dumping core..."
 
 struct foo {}
 foo[100] bar;
 int main() {
         return 0;
 }
 
 However, if I make 'bar' a dynamic array and allocate it in main with
 "bar = new foo[100];" then it works fine.

It was my fault, fixed now. Walter's internal API for struct initialisers is... uh... inconsistent.
Nov 01 2002