This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] Fixes to bootstrap from a C++ compiler (part 1)

Mark Mitchell:

> Well, how do people feel about this?  Is it good to rely on C's implicit
> conversion between "void *" and other pointer types, or is OK to insert
> casts necessary to satisfy the more restrictive C++ rule (where pointer
> types implicitly convert to "void*" or not vice versa)?

First of all, we should not be manipulating that many void* in the
first place -- if we do, that means we have serious abstraction
problem we should fix.  Second, I believe we should insert the
appropriate cast even if we know that it is unnecessary by
C90 rules.

> (Personally, I've always viewed the implicit conversion from "void *" to
> other pointer types in C a bug in the type system and I try to avoid
> relying on it.)

I'm on the same page as you.  It is a hole in the type system
the C committee introduced for I don't know exactly why.  I see
the implicit conversion void* -> T* a highly spurious programming
style.  I would definitely recommend against it.

-- Gaby

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]