[Mono-list] Is it a bug?
Guenther Roith
groith@tcrz.net
Thu, 15 Aug 2002 20:30:00 +0200
Hi!
It's not a bug in mono/mint, but in mcs.
The code _is_ incorrect, I've tried to compile it with csc, and it stops.
If I compile with mcs it works and mono, mint and even the .NET Framework
crash.
The output from csc:
complex.cs(46,17): error CS1502: Die beste Übereinstimmung für die
überladene
Methode 'System.Console.WriteLine(bool)' hat einige ungültige
Argumente
complex.cs(46,36): error CS1503: Argument '1': kann nicht von 'void' zu
'bool'
konvertiert werden
Johannes
> I am trying to implement a simple class for handling complex numbers.
> When I compile a piece of code it works but when I try to run the code
> there is an error:
>
>
> [hs@duron klassen]$ mcs complex.cs
> Compilation succeeded
> [hs@duron klassen]$ mono complex.exe
>
> ** (process:26579): WARNING **: unknown type 01
>
> ** ERROR **: file helpers.c: line 113 (mono_map_stind_type): should not
> be reached
> aborting...
> Aborted
>
>
>
>
> [hs@duron klassen]$ mint complex.exe
> 110 + 220
> ** (process:26593): WARNING **: got type 1
>
> ** ERROR **: file interp.c: line 472 (stackval_to_data): should not be
> reached
> aborting...
> Aborted
>
>
> I guess my program works (I have copied it from a tutorial) but somehow
> there seems to be something wrong.
> Here is the code I am trying to run:
>
> using System;
>
> public class Complex
> {
> int x;
> int y;
>
> // Konstruktor fuer 'leere' Zahlen
> public Complex()
> {
> }
>
> // Konstruktor fuer zum Initialisieren von Werten
> public Complex(int i, int j)
> {
> x = i;
> y = j;
> }
>
> // Ausgeben einer komplexen Zahl
> public void PrintComplex()
> {
> Console.Write( x + " + " + y);
> }
>
>
> // Addieren von komplexen Zahlen
> public static Complex operator+(Complex z1, Complex z2)
> {
> Complex result = new Complex();
> result.x = z1.x + z2.x;
> result.y = z1.y + z2.y;
> return result;
> }
> }
>
> public class Demo
> {
> public static void Main()
> {
> Complex zahl1 = new Complex(10, 20);
> Complex zahl2 = new Complex(100, 200);
> Complex ergebnis = new Complex();
>
> ergebnis = zahl1 + zahl2;
> Console.WriteLine( ergebnis.PrintComplex() );
> }
> }
>
>
> I am running ...
> mono-0.13_baselabs-20020731.i386.rpm on Redhat 7.3
>
> Can anybody help me?
>
> Hans
>
>
>
>
> _______________________________________________
> Mono-list maillist - Mono-list@ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>