Re: [linux-audio-dev] [ot] [rant] gcc, you let me down one time too many

From: Simon Jenkins <sjenkins@email-addr-hidden>
Date: Mon Jun 06 2005 - 21:48:31 EEST

On Mon, 2005-06-06 at 10:43 +0200, Tim Goetze wrote:
> <snip/>
> What I have is this (from caps code):
>
> class DescriptorStub
> : public LADSPA_Descriptor
> {
> /* just a constructor and destructor here */
> };
>
> template <class T>
> class Descriptor
> : public DescriptorStub
> {
> public:
> Descriptor()
> { setup(); }
>
> void setup();
>
> ...
> };
>
> The following is OK for an older g++:
>
> void
> Descriptor<AmpIV>::setup()
> {
> UniqueID = 1794;
> ...
> }
>
> but g++ since 4.0 wants this instead:
>
> template <> void
> Descriptor<AmpIV>::setup()
> {
> ...
> }
>
> I cannot for the life of me imagine a good reason why "template <>"
> should be necessary. "setup()" was never declared as a template, let
> alone one with an empty template parameter.
>
> If this is indeed prescribed by the language standard, I'll have a
> very, very hard time getting over it.

> It may not look like much but you have to understand that to me coding
> is also an exercise in aesthetics.
>

Then perhaps you shouldn't be cracking this little nut with the
sledgehammer of template specialisation, regardless of whether g++ used
to supply a non-standard one with a shorter handle? ;)

How about adding the unique IDs as static member constants to AmpIV and
its brethren like this:

class AmpIV {
    ...
public:
    static const unsigned UniqueID = 1794;
    ...
};

...which your Descriptor template can pick up without using any
specialisation like this:

template <class T>
class Descriptor
: public DescriptorStub
{
public:
    Descriptor() { UniqueID = T::UniqueID; }
     ...
};

Just a thought.

Cheers

Simon
Received on Tue Jun 7 00:15:10 2005

This archive was generated by hypermail 2.1.8 : Tue Jun 07 2005 - 00:15:10 EEST