Assign pointers of different objects to the same pointer
Andrew Haley
aph-gcc@littlepinkcloud.COM
Fri Jul 6 13:13:00 GMT 2007
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.
More information about the Gcc-help
mailing list