This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: strict-aliasing and typedefs
- From: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: Brad Lucier <lucier at math dot purdue dot edu>
- Cc: gcc at gcc dot gnu dot org
- Date: 14 May 2003 23:08:27 +0200
- Subject: Re: strict-aliasing and typedefs
- Organization: Integrable Solutions
- References: <200305142056.h4EKujuX025820@banach.math.purdue.edu>
Brad Lucier <lucier@math.purdue.edu> writes:
| I've read the documentation and done a google and gcc search, but
| I still have this question.
|
| If I have the typedefs and variables
|
| typedef int stackslot;
| typedef int heapslot;
|
| stackslot *sp;
| heapslot *hp;
|
| then can sp and hp point to the same location in memory with
| ISO C's aliasing rules?
Yes, that is because typedef-name acts like a keyword that is
synonymous for the original type, hence sp and hp can alias the same
object.
| I'm wondering if a Scheme->C compiler
| can use typedefs and ISO C's aliasing rules to tell gcc that certain
| memory locations cannot alias each other.
No, a typedef does not introduce a distinct type: It just introduces a
new type-name -- it is all syntactical.
-- Gaby