return string from inside if block => Segmentation Fault: 11
Robert M. Münch via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Jun 1 09:52:30 PDT 2015
I'm a bit confused... I have the following class:
class foo : superFoo {
aFoo spec;
aFoo lvars;
aFoo bdy;
override string toString(){
if(spec.isEmpty() && lvars.isEmpty()){
return "does spec";
}
if(lvars.isEmpty()){
return "funct spec";
}
return "function spec";
}
}
The thing is, as soon as one if the IFs is true and the return
statement is executed I get a seg-fault: 11
If I comment the IFs it works. But I can't see any differences in
returning from inside the if vs. the return at the end of the function.
Any idea?
--
Robert M. Münch
http://www.saphirion.com
smarter | better | faster
More information about the Digitalmars-d-learn
mailing list