C programmer, what does this syntax mean?

F

Feverish

I am a bit confused with the two marked lines. I have never seen such syntax
even though I read a lot
of C++ codes.

Thanks for your suggestion...



BluetoothReceiver::BluetoothReceiver()
: bandpassFilter(BPLENGTH), <--- Here
differentiatorFilter(DIFFLENGTH) <--- Here
{
m_bitrate = 1;
m_bitDelay = BITDELAYBT;

// Compute Bandpass filter coefficients and
const double h0 = sqrt(2.0) * Br;
const double kexp = -twopi * Br * Br;
for (int i=0; i<bandpassFilter.size(); ++i) {
double temp = i - (BPLENGTH *1.)/2.+.5;
temp /= Ns;
double hreal = h0 * exp(kexp * temp * temp);
bandpassFilter = Sample(hreal,0.0);
}

// Set Differentiator filter coefficients
differentiatorFilter[0] = Sample(-0.0062, 0.0);
differentiatorFilter[1] = Sample(0.0372, 0.0);
differentiatorFilter[2] = Sample(-0.4566, 0.0);
differentiatorFilter[3] = Sample(0.4566, 0.0);
differentiatorFilter[4] = Sample(-0.0372, 0.0);
differentiatorFilter[5] = Sample(0.0062, 0.0);
}
 
U

Ulrich Achleitner

I am a bit confused with the two marked lines. I have never seen such
syntax
even though I read a lot
of C++ codes.

Thanks for your suggestion...



BluetoothReceiver::BluetoothReceiver()
: bandpassFilter(BPLENGTH), <--- Here
differentiatorFilter(DIFFLENGTH) <--- Here
{
m_bitrate = 1;
m_bitDelay = BITDELAYBT;

// Compute Bandpass filter coefficients and
const double h0 = sqrt(2.0) * Br;
const double kexp = -twopi * Br * Br;
for (int i=0; i<bandpassFilter.size(); ++i) {
double temp = i - (BPLENGTH *1.)/2.+.5;
temp /= Ns;
double hreal = h0 * exp(kexp * temp * temp);
bandpassFilter = Sample(hreal,0.0);
}

// Set Differentiator filter coefficients
differentiatorFilter[0] = Sample(-0.0062, 0.0);
differentiatorFilter[1] = Sample(0.0372, 0.0);
differentiatorFilter[2] = Sample(-0.4566, 0.0);
differentiatorFilter[3] = Sample(0.4566, 0.0);
differentiatorFilter[4] = Sample(-0.0372, 0.0);
differentiatorFilter[5] = Sample(0.0062, 0.0);
}



supposed that bandpassFilter and differentiatorFilter are member variables
of class BluetoothReceiver, your to marked lines are the initialiser list
of class BluetoothReceiver's constructor.
at this place, you cannot only initialize member variables, but also call
base class constructors.
 
J

Jeff Flinn

Assuming the OP delete a preceding ':' here, other wise this would cause a
compilation error.
differentiatorFilter(DIFFLENGTH) <--- Here
{
m_bitrate = 1;
m_bitDelay = BITDELAYBT;

// Compute Bandpass filter coefficients and
const double h0 = sqrt(2.0) * Br;
const double kexp = -twopi * Br * Br;
for (int i=0; i<bandpassFilter.size(); ++i) {
double temp = i - (BPLENGTH *1.)/2.+.5;
temp /= Ns;
double hreal = h0 * exp(kexp * temp * temp);
bandpassFilter = Sample(hreal,0.0);
}

// Set Differentiator filter coefficients
differentiatorFilter[0] = Sample(-0.0062, 0.0);
differentiatorFilter[1] = Sample(0.0372, 0.0);
differentiatorFilter[2] = Sample(-0.4566, 0.0);
differentiatorFilter[3] = Sample(0.4566, 0.0);
differentiatorFilter[4] = Sample(-0.0372, 0.0);
differentiatorFilter[5] = Sample(0.0062, 0.0);
}



supposed that bandpassFilter and differentiatorFilter are member
variables of class BluetoothReceiver, your to marked lines are the
initialiser list of class BluetoothReceiver's constructor.
at this place, you cannot only initialize member variables, but also
call base class constructors.
 
M

Mike Wahler

Jeff Flinn said:
Assuming the OP delete a preceding ':' here, other wise this would cause a
compilation error.

See the original post. The colon is there (second line).

-Mike
 
S

Stewart Gordon

Jeff said:
Assuming the OP delete a preceding ':' here, other wise this would
cause a compilation error.
<snip excessive quote>

It appears that you use OE-QuoteFix, but it still somehow managed to
screw up the first paragraph. Which, among other things, recognises
certain oddball quoting prefixes and turns them all into the 'standard'
greater-than signs. This has happened in this instance, hence the
apparent extra quoting level.

I used to use OEQF too, but forget if it would've left the colon put if
it were indented by a certain number of spaces.

Stewart.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top