This is the mail archive of the gcc@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: Aliasing sets on Arrays Types


On 3/21/06, Andrew Pinski <pinskia@physics.uc.edu> wrote:
> Take the following C code:
> typedef long atype[];
> typedef long atype1[];
>
> int NumSift (atype *a, atype1 *a1)
> {
>    (*a)[0] = 0;
>    (*a1)[0] = 1;
>    return (*a)[0];
> }
> Shouldn't the aliasing set for the type atype be the same as atype1?

Im not entirely sure, but the C99 standard does at least not suggest
otherwise, instead it says (6.7.7/3) "A typedef declaration does not introduce
a new type, only a synonym for the type so specified."  And continues
with an example

After the declarations
typedef struct s1 { int x; } t1, *tp1;
typedef struct s2 { int x; } t2, *tp2;
type t1 and the type pointed to by tp1 are compatible. Type t1 is also
compatible with type struct
s1, but not compatible with the types struct s2, t2, the type pointed
to by tp2, or int.

where it explicitly says sth about structures, but not array types.

Richard.


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