gcc 3.0.2 -Wall complains about uses of member function named sscanf

Robert R. Henry rrh@cray.com
Mon Jun 3 15:44:00 GMT 2002


g++ -v:
  Reading specs from /opt/CRAYfw/gcc/3.0.2/lib/gcc-lib/sparc-sun-solaris2.8/3.0.2/specs
  Configured with: ./configure --prefix=/opt/CRAYfw/gcc/3.0.2
  Thread model: posix
  gcc version 3.0.2

For the program at the end of this note reports:
  g++ -Wall -c x.cc
  x.cc: In function `int mumble()':
  x.cc:12: warning: format argument is not a pointer (arg 3)
  x.cc:13: warning: format argument is not a pointer (arg 3)
  x.cc:13: warning: too many arguments for format

gcc should not be making assumptions that a member function named sscanf
in a class that I define has semantics like that of the global
function sscanf.

For this program:
  class Scanf {
  public:
    static int sscanf(const char *buf, const char *fmt,
      const int &x);
    static int sscanf(const char *buf, const char *fmt,
      const int &x, const int &y);
  };

  int mumble(void)
  {
    int val;
    Scanf::sscanf("17", "%d", val);
    Scanf::sscanf("17", "%d", val, val);
    return 0;
  }



More information about the Gcc-bugs mailing list