D.gnu - writeLine, double[],destructor
- Manfred Hansen (64/64) Apr 23 2003 Hallo,
Hallo,
i try to get running the examples from
http://www.kmonos.net/alang/etc/d.php under Linux
import stream;
int main( char[][] arg )
{
stdout.writeString( "Are you happy ? " );
char[] str = stdin.readLine();
if( str[0]=="y" || str[0]=="Y" )
stdout.writeLine( "That's good!" );
else
stdout.writeLine( "Oh, that's bad..." );
return 0;
}
Error Message
readLine.d(7): no property 'readLine' for type '_iobuf'
Next Example:
File : eq2d.d
import math;
double[] solve_2d_eq( double a, double b, double c )
{
double[2] x;
x[0] = (-b + sqrt(b*b - 4*a*c)) / (2*a);
x[1] = (-b - sqrt(b*b - 4*a*c)) / (2*a);
return x;
}
File test.d
import c.stdio;
import eq2d;
int main( char[][] arg )
{
double[] x = solve_2d_eq( 1, 6, 5 );
printf( "%f %f\n", x[0], x[1] );
return 0;
}
/home/hansen/d/dli-0.1.2/machine-i386.cpp(4296): unhandled type double,
double for array clear, dumping core...
Speicherzugriffsfehler
Last example for today:
import stream;
class Test
{
this()
{
print("instance of Test created.\n");
}
~this()
{
print("instance of Test destroyed.\n");
}
}
int main( char[][] arg )
{
Test t = new Test;
stdout.writeLine('lululu...');
return 0;
}
Output:
instance of Test created.
lululu...
The destructor is missing.
Have some one the same experience?
Regards,
Manfred Hansen
Apr 23 2003








Manfred Hansen <manfred toppoint.de>