Mail Archives: djgpp/2002/12/04/09:50:04
You got my curiosity up, so I checked the same operation on Cygwin. I got
a similar result, PATCHLEVEL appears not to be defined. On the other hand,
I was able to use __VERSION__ to get the right result. I took the liberty
of tacking onto your code.
As a side note, WHY can I never remember %s is the format string for string.
What a moron I am.
#include <stdio.h>
#include <iostream>
using namespace std;
int
main (void)
{
char buf[30], *p = buf;
p += sprintf (p, "gcc %d.%d %s", __GNUC__, __GNUC_MINOR__,__VERSION__);
#if defined(__GNUC_PATCHLEVEL)
p += sprintf (p, ".%d", __GNUC_PATCHLEVEL);
cout << "Yes, I am defined\n";
#endif
puts (buf);
return (0);
}
Wayne
- Raw text -