main getting parameters for function call all wrong

I'm sure this is one of those lame mistakes, but...I'm trying to make a function call in main(), and the compiler is forming the access to the arguments all wrong. Here's a snippet of main():

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <iostream>
#include <clock.h>
#include <SocReg.h>
#include <DemodShaperFilter.h>

using namespace std;

int main ()
{
    int     resetValue = 55;        // just picked a number for testing.
    DemodShaperFilter   filter(resetValue);

    bool    clockEnable = HIGH;
/*
 * arguments to drive the filter processing.
 */

    int     shaperCoeffI[NBR_CELLS];
    int     shaperCoeffQ[NBR_CELLS];
    int     combGainI, combGainQ;
    int     shaperOutI, shaperOutQ;
    bool    filterReset = LOW;

        filter.cycle(combGainI,
                 shaperCoeffI,
                 combGainQ,
                 shaperCoeffQ,
                 &shaperOutI,
                 &shaperOutQ,
                 clockEnable,
                 filterReset);
    return 0;
}


The function expects its parameters as: (int, int*, int, int*, int&, int&, bool, bool) and it appears that all is good on that end. But the compiler is giving me an error in main:

rror: no matching function for call to 'DemodShaperFilter::cycle(int&, int [32], int&, int [32], int*, int*, bool&, bool&)'


It's got all the parameters wrong from what I'm expecting. Any idea what I've done wrong here?

Thanks.
Axe the ampersands from lines 28 and 29. What you're basically going is fetching the addresses and making pointers out of them, and passing those to your function, hence the error. So...

-Albatross
Last edited on
Wow...that was easy. Once again, I get burned by my screwing up calls with arguments passed by reference.

Thanks a ton.

Just out of curiosity, any idea why the compiler malformed all eight parameters, and not just the two that I got wrong?
Actually... it "malformed" only four: int&, int&, bool&, and bool&. If I had to guess I'd say it's either due to either an optimization or maybe because your function expects constant references instead of values?

-Albatross
No, no consts in the function. Didn't it also mix up the first and third parameters?

I'm using Qt...I'll have to snoop around to find the optimization switch.

Thanks again.
Topic archived. No new replies allowed.