[arch-general] gcc: loop do not terminate

Martti Kühne mysatyre at gmail.com
Tue May 14 02:52:04 EDT 2013


Sorry if this is OT and a dumb question, but are you sure you want

On Mon, May 13, 2013 at 8:20 PM, LANGLOIS Olivier PIS -EXT
<olivier.pis.langlois at transport.alstom.com> wrote:
[...]
> struct B
> {
>         int numelem;
>         /*
>          * Old C trick to define a dynamically sizable array just by allocating
>          * sizeof(B) + (numelem-1)*sizeof(A) memory.
>          */
>         A   item[1];
> };
>

one item vs.

> void initArr(B *p);
>
> lano1106 at hpmini ~/dev/gcc-test $ cat test1_init.cpp
> #include "test1.h"
>
> void initArr(B *p)
> {
>         p->numelem = 2;
>         p->item[0].a = 1;
>         p->item[1].a = 2;
> }
>

two items?

cheers!
mar77i


More information about the arch-general mailing list