This is the mail archive of the gcc-help@gcc.gnu.org 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: Assign pointers of different objects to the same pointer


sebastian writes:

 > Is there a possibility to break through the ISO-C++ standard with a
 > instruction in gcc that let me assign different objects (&Types) to
 > the same pointer?
 > 
 > Best will be to let allow the declaration of a typeless pointer (
 > NULL *p; or NULL p;) that can be assigned with every other pointer
 > of an object (class initialisation or void members (void
 > FunctionName(void) ).  So only pointers get handled and called and
 > memory(stack) keeps being conform.  So only the functionality of
 > the programme can change on programmer's mistakes.
 > 
 > Best example is QPointer of QT. QPointer would then be not necessary any more 
 > if ISO-C++ or GCC allow (implement) this.

Well, we already have char* which aliases all object types and is
convertible to all object types, as long as it is well-aligned.  What
more do you want?

Andrew.


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