[gnu.gcc] foon

jb3o+@andrew.cmu.edu (Jon Allen Boone) (02/04/90)

Is it true that gcc interprets foo[n] as an array from foo[0] to
coo[n]?  Someone the other day was having trouble using cc on code
that depended on this rumored "feature", saying "well, it works fine
with gcc..."

I'm curious, since cc calls it foo[0] to foo[n-1] and he said he had to
change the declaration to foo[n+2] so that he could get it to work
properly under cc.

Just curious...


iain | jb3o@andrew.cmu.edu(INTERNET) | R746JB3O@cmccvb(BITNET)
--------------------------------------------------------------
disclaimer: everything is simply an opinion - it may not be
my employer's opinion; in fact, it might not be my opinion
-------------------------------------------------------------
Do What Thou Wilt Shall Be The Whole Of The Law
Love Is The Law, Love Under Will - Uncle Aleister



	

ian@sibyl.eleceng.ua.OZ (Ian Dall) (02/06/90)

In article <sZn3bQO00XooAELeQa@andrew.cmu.edu> jb3o+@andrew.cmu.edu (Jon Allen Boone) writes:
>Is it true that gcc interprets foo[n] as an array from foo[0] to
>coo[n]?

No it isn't true, and if it did it would be a bug. However, there may
be allignment restrictions which result in the space beyond the end of
an array being free. It is not surprising that such incorrect code might
sometimes work on one compiler but fail on another.
-- 
Ian Dall     life (n). A sexually transmitted disease which afflicts
                       some people more severely than others.