Re: Support for qualifiers
Andreas Kostyrka <[email protected]>
| Newsgroups | gmane.comp.python.pyrex |
|---|---|
| Message-ID | <1206694461.11011.127.camel@localhost> |
Actually, one thing that might be non trivial is the fact that you can
have a non-const pointer to something const, you can have a const
pointer to something non-const, and naturally, a const pointer to
something const.
To solve the problem generically, you have 2**(n+1) different kinds of
const-ness possible a n-types pointer.
main() {
const int a=10;
int b=11;
const int *p = &a;
int * const o = &b;
const int * const q = &a;
}
Andreas
Am Mittwoch, den 26.03.2008, 12:25 +1200 schrieb Greg Ewing:
> Jelmer Vernooij wrote:
> > I figured it would simply be a matter of tracking whether
> > something is const. Would there be more required than that?
>
> The type compatibility rules all become more complicated.
> For instance, you can assign a char * to a const char *,
> but not the other way around.
>
> The parsing gets more complicated as well. I'm not even
> confident I know all the places you're allowed to insert
> a 'const' into a C declaration, and what they all mean.
>
> It's all doable, but it will require some careful thought.
>
_______________________________________________
Pyrex mailing list
[email protected]
http://lists.copyleft.no/mailman/listinfo/pyrex
signature.asc
(application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQBH7LI9HJdudm4KnO0RAiPgAJ9/eM3d0HyGEa3Xx3grmxqVEVoqXgCfZ6IG ox/PzxNIqu6pP0pSEuPRzEc= =HSx8 -----END PGP SIGNATURE-----