segfaults

Bernard Helyer b.helyer at gmail.com
Mon May 3 14:25:30 PDT 2010


On 04/05/10 08:57, Lars T. Kyllingstad wrote:
> On Mon, 03 May 2010 15:54:28 -0500, Ellery Newcomer wrote:
>
>> Hello.
>>
>> I'm trying to invoke a command inside d, and it returns a success code
>> when the command in question segfaults.
>>
>> any ideas?
>>
>> // the caller
>> import std.process;
>>
>> int main(){
>>       auto r = system("./test");
>>       return(r);
>> }
>>
>>
>> //test.d
>> import std.stdio;
>>
>> void main()
>> {
>>       Object o;
>>       writeln(o.toString());
>> }
>
> It's a null dereference.  What you're doing is essentially
>
>    Object o = null;
>    writeln(o.toString());
>
> -Lars


I believe his problem is that the return code of the caller indicates 
success.


More information about the Digitalmars-d-learn mailing list