delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/12/04/09:50:04

Message-ID: <30C9E24891FFD411B68A009027724CB702C04E42@eg-002-015.eglin.af.mil>
From: Keen Wayne A Contr AFRL/MNGG <keenwa AT eglin DOT af DOT mil>
To: "'djgpp AT delorie DOT com'" <djgpp AT delorie DOT com>
Subject: gcc 3.2.1 Version
Date: Wed, 4 Dec 2002 08:38:47 -0600
X-Mailer: Internet Mail Service (5.5.2653.19)
Reply-To: djgpp AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019