Mark Dowdy(deleted)
|
Trouble with va_list in 6.5.0
|
Mark Dowdy(deleted)
10/01/2010 9:43 PM
post69364
|
Trouble with va_list in 6.5.0
I see in topic topc5112 that a problem with va_list was fixed in the 6.5.0 tool chain. I'm not sure if it was this "fix"
or not but our existing code base will not compile using the 6.5.0 tools due to a va_list error. The error I'm seeing
is "error: 'va_list' was not declared in this scope". I can fix the problem when building with the 6.5.0 tools by
including a line containing "using std::va_list;" after including cstdarg. Unfortunately, we have multiple build
products and some of them use legacy development tools (i.e. 6.3.0 and 6.3.2). With the mentioned "using" line, these
older compilers yack. I don't like doing it but I tried putting a "#if (_NTO_VERSION >= 650)" around the "using" line
but that doesn't work for the 6.5.0 tools. Is _NTO_VERSION not supported in the 6.5.0 tool chain? Here's a code snippet
to recreate the problem.
#include <cstdarg>
#if __QNXNTO__
#if (_NTO_VERSION >= 650) // remove to get 6.5.0 to work
using std::va_list;
#endif // remove to get 6.5.0 to work
#endif
#include <string.h>
void va_cat(char *s, ...)
{
char *t;
va_list ap;
va_start(ap, s);
while ((t = va_arg(ap, char *)))
{
s += strlen(s);
strcpy(s, t);
}
va_end(ap);
}
The code above compiles using the 6.3.0 tools but not the 6.5.0 tools. Removing the "#if (_NTO_VERSION >= 650)"
conditional compilation makes the code compile using the 6.5.0 tools but it then fails with the 6.3.0 tools. Any ideas
how to make va_list work with the 6.3.0, 6.3.2 and 6.5.0 tools? Thanks.
Mark
|
|
|