Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > macro passed wrong number of arguments

Reply
Thread Tools

macro passed wrong number of arguments

 
 
Martin Magnusson
Guest
Posts: n/a
 
      06-15-2004
I'm using a matrix and vector library, that won't compile. When
running g++ I get the error message "macro "minor" passed 5 arguments,
but takes just 1"

The definition of "minor" looks like below, and it takes 3 arguments.
All calls to minor that I have found in the code also pass it three
arguments, so I really don't understand this error.

Does anything look suspicious with the following definition, or must
it be that there is some other definition of minor with a different
number of arguments somewhere?

template <int N, typename T>
T minor(const Vector<N,Vector<N,T> >& in, int row, int col) //ERROR
{
Vector<N-1,Vector<N-1,T> > tmp;
int dst_row, dst_col;
dst_row = 0;
for (int src_row = 0; src_row < N; src_row++) {
if (src_row == row) continue;
dst_col = 0;
for (int src_col = 0; src_col < N; src_col++) {
if (src_col == col) continue;
tmp[dst_row][dst_col] = in[src_row][src_col];
dst_col++;
}
dst_row++;
}
return det(tmp);
}



Thanks
/ martin
 
Reply With Quote
 
 
 
 
Rolf Magnus
Guest
Posts: n/a
 
      06-15-2004
Martin Magnusson wrote:

> I'm using a matrix and vector library, that won't compile. When
> running g++ I get the error message "macro "minor" passed 5 arguments,
> but takes just 1"
>
> The definition of "minor" looks like below, and it takes 3 arguments.
> All calls to minor that I have found in the code also pass it three
> arguments, so I really don't understand this error.


The definition below is a template, not a macro. So it seems to me that
somewhere in your code or any header you #include, a macro is defined
that also has the name "minor".

> Does anything look suspicious with the following definition, or must
> it be that there is some other definition of minor with a different
> number of arguments somewhere?


The latter.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Call again a variadic function (... variable number of arguments)with same arguments that its variadic wrapper moreau.steve@gmail.com C Programming 3 12-31-2008 07:13 AM
functions and arguments.length; passing unknown number of arguments oldyork90 Javascript 10 09-27-2008 03:05 AM
Mapping a macro with variable number of arguments to a variadic function rashmi C Programming 6 12-07-2006 07:12 AM
Variable Number of Arguments in Macro Praveen.Kumar.SP@gmail.com C++ 10 06-30-2006 08:08 AM
macro passed wrong number of arguments Martin Magnusson C++ 4 06-15-2004 05:01 PM



Advertisments
 



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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57