Re: is this intentional?
From: aegis (aegis_at_mad.scientist.com)
Date: 01/26/05
- Next message: Keith Thompson: "Re: how to write a tutorial"
- Previous message: Nick Austin: "Re: pointer to array of const objects"
- In reply to: pete: "Re: is this intentional?"
- Next in thread: Michael Mair: "Re: is this intentional?"
- Reply: Michael Mair: "Re: is this intentional?"
- Reply:(deleted message) Richard Kettlewell: "Re: is this intentional?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Next message: Keith Thompson: "Re: how to write a tutorial"
- Previous message: Nick Austin: "Re: pointer to array of const objects"
- In reply to: pete: "Re: is this intentional?"
- Next in thread: Michael Mair: "Re: is this intentional?"
- Reply: Michael Mair: "Re: is this intentional?"
- Reply:(deleted message) Richard Kettlewell: "Re: is this intentional?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]