Mail Archives: cygwin/1997/09/23/03:28:16
Hi,
The cygnus' gcc-2.7.2 of the windows port (b18), has different
behaviour than gcc-2.7.2{.x} on unix boxes.  It prints lots of 
new warnings (even in reent.h, math.h) to the sadly scrolling 
dos box, and more seriously, "finds" errors that other gcc's 
don't find.  Although some errors found on windows really are 
errors, this still means that code that compiles on unix often 
breaks on windows; and has to be "ported" again.
Wouldn't it be nice if the extra errors found on windows could
be found on unix too, and if the ghost-errors would go away.
Or, uhmm if the extra errors were converted to warnings (in b19?) 
until they can be detected on unix.
It would be nice if the -w switch worked for the poor dos box.
Here is an example:
/*
 gcc-warn.cc
 silly c++ source for "gcc 2.7.2" on several platforms
 
 On unix platforms, e.g.:
     09:27:15 mfb ~/lelie/lilypond-0.1.16.jcn1$ gcc -v
     Reading specs from /usr/lib/gcc-lib/i386-linux/2.7.2.1/specs
     gcc version 2.7.2.1
 or
     9:27:34 gin ~/c++$ gcc -v
     Reading specs from /home/jan/usr/local/lib/gcc-lib/sparc-sun-solaris2.5/2.7.2.1/specs
     gcc version 2.7.2.1
 do
     make 'CFLAGS= -Wall -W -Wmissing-prototypes -Wmissing-declarations -Wconversion' gcc-warn
 and gcc compiles and links without a wink.
 On 
     09:35:16 MUB ~/c++$ gcc -v
     Reading specs from \gnuwin32\b18\H-i386-cygwin32\lib\gcc-lib\i386-cygwin32\cygnus-2.7.2-970404\specs
     gcc version cygnus-2.7.2-970404
 
 do
     make 'CFLAGS=-w' gcc-warn
 and get (lots of warnings in spite of -w), and:
     gcc-warn.cc:30: syntax error before `('    // yup, an error
     gcc-warn.cc: In function `int main()':
     gcc-warn.cc:37: ambiguous overload for `Foo & + int' // hmm...
     gcc-warn.cc:37: candidates are: operator +(int, int) <builtin>
     gcc-warn.cc:37:                 operator +(const char *, int) <builtin>
     gcc-warn.cc:23:                 operator +(Foo, Foo)
 */
class Foo
{
public:
	Foo (int i)
	{
		i_ = i;
	}
	operator char const* ()
	{
		return "";
	}
	operator int ()
	{
		return i_;
	}
private:
	int i_;
};
char const* operator +(Foo left, Foo right)
{
	return (char const*)left + (int)right;
}
class Bar
{
public:
	Foo ();
};
int
main ()
{
	Foo a (0);
	char const* p = a + 1;
	return 0;
}
Jan Nieuwenhuizen <jan AT digicash DOT com> | LilyPond - The GNU music typesetter
http://www.digicash.com/~jan         | http://www.stack.nl/~hanwen/lilypond/
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".
- Raw text -