This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Assign pointers of different objects to the same pointer
- From: Andrew Haley <aph-gcc at littlepinkcloud dot COM>
- To: sebastian <sebastian dot bw at freenet dot de>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Fri, 6 Jul 2007 14:13:32 +0100
- Subject: Re: Assign pointers of different objects to the same pointer
- References: <200707061300.02725.sebastian.bw@freenet.de>
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.