Mail Archives: cygwin/2001/08/26/13:14:59
> Well, that's interesting. Since arrays ARE pointers(*), then perhaps
> it's enough to change gcc's behavior from
Not from gcc's perspective. From C's perspective, array symbols and
pointer symbols are mostly interchangeable, but they are not the same.
For example, these two declarations:
extern char *foo;
extern char foo[];
are *not* the same, and using the wrong one results in a broken
program.
For our purposes, a pointer is a symbol referencing a four-byte range
of memory that holds the address of a range of memory that holds a
sequence of characters, and an array is a symbol referencing a range
of memory that holds a sequence of characters. Because a pointer
requires an extra indirection, gcc is limited in the optimizations it
can do on it, but dealing with imports becomes simpler because the
address occurs in exactly one place.
Since a symbol is always a constant (regardless of what it refers to),
offsetting it by a constant results in a sum that can always be
computed at compile time (well, link time) and gcc will always do it
that way. This is a fairly fundamental concept in gcc, and I doubt it
would be practical to tell gcc to do it otherwise.
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -