This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Namespace of function (CTOR) parameters


  
Hello.

An user of my pitchtracking software complain because he gets this error
at link time.

> undefined reference to PitchQuantizer::PitchQuantizer(Listener &, int, double)

Here's an excerpt of the PitchQuantizer class declaration:

> class PitchQuantizer
> {
> public:
>         typedef enum {STRONG, WEAK} Smoothmode;
> private:
>         int smoothn, bindex;
>         Smoothmode smoothmode;
>[...snip...]
>         
> public:
>         PitchQuantizer(int, real_t, Smoothmode mode = WEAK);
>         PitchQuantizer(Listener &, int, real_t, Smoothmode mode = WEAK);
> [..snip...]
> };

I use a typedef as shorthand to an enum, but I think that the problem'd
arise even without the typedef.

Then I define a constructor this way:

> PitchQuantizer::PitchQuantizer(int steps, real_t af, Smoothmode mode = WEAK)
> {
>      [...snip...]
> }

note that my code is not very clear (or maybe it's wrong!) because it
didn't prepended PitchQuantizer:: to Smoothmode.

I compile this code with egcs-2.91.66 with -wall and I get no errors and
no warnings and the program works correctly.

My user has egcs-2.90.27 and he gets the errors above at link time but
no errors from the compiler. I requested the output of 'nm' and from the
signature of the function I can see that MY compiler understands what I
mean (PitchQuantizer::Smoothmode) even without specifying the namespace.
Of course this may not be a good thing, but it does.
The OTHER compiler does the right thing: it doesn't apply the function
name's namespace to the parameters. The problem is that it doesn't
complain.

What compiler is right?

Maurizio Umberto Puxeddu

--
TiscaliFreeNet, libero accesso ad Internet.
http://www.tiscalinet.it


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]