Hi ptolemy hackers,

we are using Ptolemy 0.7 on Solaris 2.6 with gcc version 2.7.2.2, and
Ptolemy 0.7.1 on Linux with gcc version egcs-2.90.27 980315 (egcs-1.0.2
release).
Some stars we develloped with Ptolemy 0.7 under Solaris don't compile
under Ptolemy 0.7.1 on Linux. The line that produces the error contains
a typecast from a "ComplexParticle" to a "Complex". In the source code
of the star we define the following:


    input {
        name { input }
        type { complex }
    }

    ...

    go {
        Complex F[100];

        ...
    }


The offending line is the following (in the go-routine):

    F[m] = Complex(input%0);


While this compiles in Ptolemy 0.7 without problems, Ptolemy 0.7.1
produces the following error:

    Loader: errors in compilation
    SDFSparafile.pl In method 'void SDFSparafile::go()'
    SDFSparafile.pl:137: call of overloaded 'Complex(Particle &)' is
ambiguous
    /users/ptolemy-0.7.1 p1-3/src/kernel/ComplexSubset.h:54: candidates
are:
    Complex::Complex(double, double)
    /users/ptolemy-0.7.1 p1-3/src/kernel/ComplexSubset.h:55:
    Complex::Complex(const Complex &)

A possible explanation for this problem might be:
there is no constructor of the type Complex(Particle &), so the compiler
just reports in an error message which constructors are defined.
There is an operator Complex defined in the class Particle, although we
are not sure if it is Standard C++ to define operators others than those
already specified in C++. In Ptolemy 0.7 this definition seems to work
well while in 0.7.1 the compiler does not recognize Complex(input%0) as
an operator belonging to the class ComplexParticle.
If we rewrite the offending line as:

F[m] = (input%0).operator Complex();

the stars compiles without errors. Also, the shortest version

F[m] = input%0;

seems to work, but I am reluctant to assign a variable of one class to
another without an explicit typecast or without being sure how the
conversion is done.
So, my questions are:
1. What is the cause of the described error?
2. What is the best way to convert a variable of the type
ComplexParticle to the type Complex?

Many thanks,

Stephan Pfletschinger

--
Stephan Pfletschinger
Institut fuer Nachrichtenuebertragung   Institute of Telecommunications
Universitaet Stuttgart                  University of Stuttgart
Tel: 0711/685-7939                      http://www.inue.uni-stuttgart.de




----------------------------------------------------------------------------
Posted to the ptolemy-hackers mailing list.  Please send administrative
mail for this list to: [EMAIL PROTECTED]

Reply via email to