Re: is this intentional?

From: aegis (aegis_at_mad.scientist.com)
Date: 01/26/05


Date: 26 Jan 2005 01:17:59 -0800


pete wrote:
> aegis wrote:
> >
> > typedef struct foo *FOO;
> >
> > struct foo {
> > int a;
> > };
> >
> > void func(const FOO baz);
> >
> > int main(void)
> > {
> > struct foo baz;
> > func(&baz);
> > return 0;
> > }
> >
> > void func(const FOO baz)
> > {
> > static struct foo test;
> > baz = &test;
> > return ;
> > }
> >
> > this treats "baz" as a const pointer
> > to struct foo and not a pointer to struct foo
> > qualified by const. if FOO was really a synonym
> > for struct foo, it would not do this.
>
> If FOO was really a synonym for struct foo,
> then your code would look like this:
>
> typedef struct foo FOO;
> void func(const FOO *baz);
>
> --
> pete

I of course meant

"if FOO was really a synonym for struct foo *, it would not do this"
my original question remains.

--
aegis