digitalmars.D.learn - No dynamic Arrays in Struct?
- Manfred Nowak (7/7) Feb 09 2007 void main(){
- torhu (4/10) Feb 10 2007 You can't have an assignment in the struct definition. Try just using
- Manfred Nowak (3/4) Feb 10 2007 Oooops. Thank you. I was misleaded by the error message.
- Chris Nicholson-Sauls (7/13) Feb 10 2007 Try
- Jarrett Billingsley (4/16) Feb 10 2007 You can't have non-static initializers for aggregate member declarations...
void main(){ struct S{ int[] map; map.length= 1000; // error: no identifier for declarator map.length } S s; } -manfred
Feb 09 2007
Manfred Nowak wrote:void main(){ struct S{ int[] map; map.length= 1000; // error: no identifier for declarator map.length } S s; }You can't have an assignment in the struct definition. Try just using 'int[1000] map;' instead. Or set the size in a function, if you want to have a dynamic array with preset length.
Feb 10 2007
torhu wroteYou can't have an assignment in the struct definition.Oooops. Thank you. I was misleaded by the error message. -manfred
Feb 10 2007
Manfred Nowak wrote:torhu wroteTry struct S { int[] map = new int[1000]; } /Should/ work I believe, if you really want the length dynamic. -- Chris Nicholson-SaulsYou can't have an assignment in the struct definition.Oooops. Thank you. I was misleaded by the error message. -manfred
Feb 10 2007
"Chris Nicholson-Sauls" <ibisbasenji gmail.com> wrote in message news:eql1r2$a2f$1 digitaldaemon.com...Manfred Nowak wrote:You can't have non-static initializers for aggregate member declarations.torhu wroteTry struct S { int[] map = new int[1000]; } /Should/ work I believe, if you really want the length dynamic.You can't have an assignment in the struct definition.Oooops. Thank you. I was misleaded by the error message. -manfred
Feb 10 2007