0

I'm trying to follow some tutorials for JUCE (audio processing API). In a synth wave plugin there is a class with the following:

//========================================================================
/** A demo synth sound that's just a basic sine wave.. */

class SineWaveSound : public SynthesiserSound
{
public:
    SineWaveSound() {}

    bool appliesToNote (int /*midiNoteNumber*/) override  { return true; }
    bool appliesToChannel (int /*midiChannel*/) override  { return true; }
};

Notice the function arguments have a data type but lack the conventional variable name that should accompany them.

I've never seen this before. Can somebody please explain why this is valid. The plugin works as expected.

Frxstrem
  • 38,761
  • 9
  • 79
  • 119
Miek
  • 1,127
  • 4
  • 20
  • 35
  • The real question here is: why shouldn't it be valid? Many people asking this question come from C background, and in C this is not allowed. But in C language this was prohibited since it would create ambiguity between K&R-style function declarations and prototype-style ones. Since in C++ this ambiguity is not present, the restriction is no longer there. – AnT stands with Russia Jul 12 '15 at 16:09

1 Answers1

2

It is valid because the language specification says so. The names aren't used anywhere, so they aren't needed.

juanchopanza
  • 223,364
  • 34
  • 402
  • 480
  • Thanks for pointing out the duplicate. I read the other link and now I understand. Its most likely an interface of sorts used differently in different places. The commented out names may be uncommented for some cases. – Miek Jul 12 '15 at 16:00