Re: GCC 2.95 & GNOME Apps



Havoc Pennington wrote:
> 
> On Sat, 7 Aug 1999, SEGV wrote:
> >
> > I suppose my question is: will GNOME ever be type safe and sound?
> 
> It will if people submit patches... if binary compatible they can even go
> in 1.0.x. I don't think a question like this is justified by a couple bugs
> ni a brand-new compiler few people are using yet.

It's (almost) always been an error to use a const char* to
initialize/assign anything other than a const char* or (to avoid
breaking code) a char*.

>From Stroustrup's "The C++ Programming Langage" 3rd ed. 5.2.2 "String
Literals":

"A string literal can be assigned to a char*. This is allowed because in
previous definitions of C and C++, the type of a string literal was
char*. Allowing the assignment of a string literal to a char* ensures
that millions of lines of C and C++ remain valid. It is, however, an
error to try to modify a string literal through such a pointer."

GNOME was written since that change. But I suppose without compiler
enforcement those kinds of errors are easy to miss. Especially in the
presence of the preprocessor. (I had assumed those macros were integer
constants, not string constants!)

As for the overloading ambiguity the new compiler version unmasked, that
would not be a problem if the callbacks were typed. Using (...) disables
all type checking of function pointer types.

>From Stroustrup's "The C++ Programming Langage" 3rd ed. 7.6 "Unspecified
Number of Arguments":

"Clearly, if an argument has not been declared, the compiler does not
have the information needed to perform the standard type checking and
type conversion for it. ... A well-designed program needs at most a few
functions for which the argument types are not completely specified."

Under the current scheme, there is no type checking on callback
registration and such callbacks cannot be overloaded (under a new
compiler).


> Very few people are using 2.95, thus you're finding bugs. We do want to
> work with that compiler, so if you want to use it now, please submit
> gnome-libs patches. Otherwise, we'll fix it when we upgrade to that
> compiler. :-)
> 
> At a minimum, please send a bug report to bugs.gnome.org so we remember to
> deal with this issue.

I will.

-- 
SEGV  -  http://www.cgocable.net/~mlepage/
Features Minion real-time strategy game, RTS game programming info,
GTK+ tutorial, etc.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]