![]() |
| | #1 |
| Registered User Join Date: Nov 2006
Posts: 510
| warning C4002: too many actual parameters for macro 'assert' This compiles: Code: double a = cmath::euclideanDistance2D<BlasVector,double>(mTargetPosition, mrEntity.vehicleModel().pos()); assert(10.0 < a); Code: assert(10.0 < cmath::euclideanDistance2D<BlasVector,double>(mTargetPosition, mrEntity.vehicleModel().pos())); Code: 1>.\GoalMoveXY.cpp(46) : warning C4002: too many actual parameters for macro 'assert'
1>.\GoalMoveXY.cpp(46) : error C2143: syntax error : missing ',' before ')'
1>.\GoalMoveXY.cpp(46) : error C2059: syntax error : ')'
1>.\GoalMoveXY.cpp(46) : error C2143: syntax error : missing ',' before ')'
1>.\GoalMoveXY.cpp(46) : error C2059: syntax error : ')'
1>.\GoalMoveXY.cpp(50) : error C2143: syntax error : missing ',' before ')'
1>.\GoalMoveXY.cpp(53) : error C2065: 'way' : undeclared identifier
1>.\GoalMoveXY.cpp(53) : error C2228: left of '.rend' must have class/struct/union
1> type is ''unknown-type''
1>.\GoalMoveXY.cpp(53) : error C2143: syntax error : missing ',' before ')'
1>.\GoalMoveXY.cpp(56) : error C2143: syntax error : missing ';' before '}'
1>.\GoalMoveXY.cpp(60) : error C2143: syntax error : missing ';' before '{'
1>.\GoalMoveXY.cpp(65) : error C2143: syntax error : missing ';' before '{'
1>.\GoalMoveXY.cpp(68) : error C2143: syntax error : missing ';' before '}'
1>.\GoalMoveXY.cpp(70) : error C2143: syntax error : missing ';' before '{'
1>.\GoalMoveXY.cpp(71) : error C2143: syntax error : missing ',' before ')'
1>.\GoalMoveXY.cpp(72) : error C2143: syntax error : missing ',' before ')'
1>.\GoalMoveXY.cpp(81) : error C2143: syntax error : missing ';' before '{'
1>.\GoalMoveXY.cpp(83) : error C2143: syntax error : missing ';' before '}'
1>.\GoalMoveXY.cpp(84) : error C2143: syntax error : missing ';' before '}'
1>.\GoalMoveXY.cpp(87) : error C2143: syntax error : missing ';' before '}'
1>.\GoalMoveXY.cpp(90) : error C2143: syntax error : missing ';' before '}'
1>.\GoalMoveXY.cpp(91) : error C2143: syntax error : missing ';' before '}'
1>.\GoalMoveXY.cpp(91) : fatal error C1004: unexpected end-of-file found
Thank you!
__________________ http://sourceforge.net/projects/path-finder-as |
| pheres is offline |
| | #2 |
| Kernel hacker Join Date: Jul 2007 Location: Farncombe, Surrey, England
Posts: 15,686
| They probably are, but perhaps you need an extra set of paranthesis, as the preprocessor has no idea what a template is, and will just split arguments by commas. -- Mats
__________________ Compilers can produce warnings - make the compiler programmers happy: Use them! Please don't PM me for help - and no, I don't do help over instant messengers. |
| matsp is offline |
| | #3 |
| Cat without Hat Join Date: Apr 2003
Posts: 8,579
| More precisely, it doesn't recognize < > as comma-masking. So yes, you need an extra pair of parenthesis.
__________________ All the buzzt! CornedBee"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code." - Flon's Law |
| CornedBee is online now |
| | #4 | |
| Kernel hacker Join Date: Jul 2007 Location: Farncombe, Surrey, England
Posts: 15,686
| Quote:
-- Mats
__________________ Compilers can produce warnings - make the compiler programmers happy: Use them! Please don't PM me for help - and no, I don't do help over instant messengers. | |
| matsp is offline |
| | #5 |
| Cat without Hat Join Date: Apr 2003
Posts: 8,579
| But it doesn't need to know anything else. It's the commas that get you in trouble.
__________________ All the buzzt! CornedBee"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code." - Flon's Law |
| CornedBee is online now |
| | #6 | |
| Kernel hacker Join Date: Jul 2007 Location: Farncombe, Surrey, England
Posts: 15,686
| Quote:
-- Mats
__________________ Compilers can produce warnings - make the compiler programmers happy: Use them! Please don't PM me for help - and no, I don't do help over instant messengers. | |
| matsp is offline |
| | #7 |
| Registered User Join Date: Jan 2007
Posts: 250
| I guess the preprocessor sees it as: Code: assert(x < y < z,double>(mTargetPosition, mrEntity.vehicleModel().pos())); |
| KIBO is offline |
| | #8 |
| Kernel hacker Join Date: Jul 2007 Location: Farncombe, Surrey, England
Posts: 15,686
| Yes, something like that. There are very few things in the syntax that matters to the preprocessor. It knows about whitespaces, comma, lparen '(' and rparen ')', the # sign, and that's about it. The rest of it is about text replacement of given parameters. -- Mats
__________________ Compilers can produce warnings - make the compiler programmers happy: Use them! Please don't PM me for help - and no, I don't do help over instant messengers. |
| matsp is offline |
| | #9 |
| Registered User Join Date: Nov 2006
Posts: 510
| Thank you all. Another pair of parenthesis did the trick.
__________________ http://sourceforge.net/projects/path-finder-as |
| pheres is offline |
| | #10 |
| Cat without Hat Join Date: Apr 2003
Posts: 8,579
| Strings. It knows about strings.
__________________ All the buzzt! CornedBee"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code." - Flon's Law |
| CornedBee is online now |
| | #11 |
| Kernel hacker Join Date: Jul 2007 Location: Farncombe, Surrey, England
Posts: 15,686
| Yes, of course. As in "somestuff", not std::strings ![]() -- Mats
__________________ Compilers can produce warnings - make the compiler programmers happy: Use them! Please don't PM me for help - and no, I don't do help over instant messengers. |
| matsp is offline |
| | #12 |
| Registered User Join Date: Jul 2009
Posts: 1
| In case you want to "protect" a comma and parenthesis don't work (for example with templates), you can use the following macro: Code: #define CONCAT(...) __VA_ARGS__
#define ID(x) x
//...
printf("%s %s!\n", ID(CONCAT("hello", "world")) );
HTH, Ingo Last edited by CornedBee; 07-14-2009 at 08:15 AM. |
| ingomueller.net is offline |
| | #13 |
| Registered User Join Date: Jan 2008
Posts: 920
| O_o Did you actually just search for questions to answer in order to advertise your site as a pathetic attempt to circumvent the rules? Anyway, this is the C++ forum--not the C99 forum. Soma |
| phantomotap is offline |
| | #14 |
| C++0x User Join Date: Nov 2008 Location: Sweden
Posts: 133
| |
| Tux0r is offline |
| | #15 |
| Cat without Hat Join Date: Apr 2003
Posts: 8,579
| Link deleted, thread closed. Don't resurrect old threads, especially in order to promote your site.
__________________ All the buzzt! CornedBee"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code." - Flon's Law |
| CornedBee is online now |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| pointers, structures, and malloc | lugnut | C Programming | 24 | 10-09-2008 04:52 PM |
| warning C4013...errrrrr! | IndioDoido | C Programming | 27 | 03-21-2008 02:02 AM |
| Script errors - bool unrecognized and struct issues | ulillillia | Windows Programming | 10 | 12-18-2006 04:44 AM |
| warning C4003: not enough actual parameters for macro 'min' | Magos | C++ Programming | 2 | 01-20-2004 05:33 PM |
| Interface Question | smog890 | C Programming | 11 | 06-03-2002 05:06 PM |