Re: What's wrong with alloca() in gcc????

angular!jas@Sun.COM (Jim Shankland)
Wed, 1 Jan 1992 19:15:24 GMT

          From comp.compilers

Related articles
What's wrong with alloca() ? preston@dawn.cs.rice.edu (1991-12-19)
Re: What's wrong with alloca() in gcc???? mo@gizmo.bellcore.com (1991-12-31)
Re: What's wrong with alloca() in gcc???? ted@nmsu.edu (1991-12-31)
Re: What's wrong with alloca() in gcc???? angular!jas@Sun.COM (1992-01-01)
Re: What's wrong with alloca() in gcc???? tarjeij@ulrik.uio.no (1992-01-02)
| List of all articles for this month |
Newsgroups: comp.compilers
From: angular!jas@Sun.COM (Jim Shankland)
Keywords: storage
Organization: Angular Systems
References: 91-12-075 91-12-090
Date: Wed, 1 Jan 1992 19:15:24 GMT

In article 91-12-090 mo@gizmo.bellcore.com (Michael O'Dell) writes:
>At least at one time, the dynamic array stuff in gcc was very broken
>in that if you have
>
> int foo[z];
>
>sizeof(foo) returned sizeof(int). This is so wrong as to be beyond
>belief. Yes, it is hard to make it work right, but then, that's why
>one should think hard about putting in such "features".


It works now.


I'd be willing to bet it wasn't really returning sizeof(int), but rather
sizeof(int *): erroneously doing the conversion to pointer to first
member. I seem to remember a version of the System V compiler back around
'83 that made the same mistake for plain old static arrays: sizeof(any
array) was 4. I'm not sure when something that's wrong becomes "so wrong
as to be beyond belief" ....


Any feature incorrectly implemented is likely not to be useful.
Personally, I prefer dynamic arrays to alloca(), . Too bad they're not C.


jas
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.