-5

I am trying to build my code but getting error in below lines in header file sample.h

 1   #ifndef FORMAT_STRING_H
 2   #define FORMAT_STRING_H
 3   
 4   #define FORMAT_STR( ovr, x, y, ... ) \
 5   { \
 6      char buf[100]; memset(buf, 0, 100);\
 7      using namespace std; \
 8      snprintf(buf, 99,  __VA_ARGS__); \
 9      ovr->drawStr( x, y, buf );\
 10  }
 11  #endif //FORMAT_STRING_H

and getting error at line 4 error: expected an identifier . I am not able to understand what is the problem exactly in mentioned line . I am using Ti DSP C6000 Code Generation Tools 7.3.0B3 compiler . Compiling C++ code .

Ashwin
  • 411
  • 1
  • 10
  • 28

1 Answers1

3

It seems your compiler does not support a function-like macro with variable number of arguments.

It is very simple to check this. Write for example

#define FORMAT_STR( ovr, x, y, ... )\
{\
}

and do not call it in the code. If the compiler will issue the same error then indeed it does not support such macros.

Vlad from Moscow
  • 301,070
  • 26
  • 186
  • 335
  • 1
    Seems to be correct, the [C6000 compiler](http://processors.wiki.ti.com/index.php/Overview_of_C%2B%2B_Support_in_TI_Compilers#Status_as_of_March_2014) does not support C++11, and [the C++03 standard does not support variadic macros](http://stackoverflow.com/questions/4786649/are-variadic-macros-nonstandard). – Joachim Isaksson May 20 '14 at 17:35