Hi Timothy/
The code below is kind of a C-trick (or hack) based on the knowledge of how the
C-compiler lays out structs in memory.
In your example it would be:
struct layout
+--+
| a
+--+
| b
+--+
| _data[0]
+--+
Adding the +64, gives you 64 extra bytes (64/4) = 16 int's if siz
Hi Timothy,
On Tue, 30 Oct 2018 at 00:42, Timothy Baldridge wrote:
> typedef struct foo_t {
> int a, b;
> int _data[0];
> }
>
> foo_t tmp = malloc(sizeof(foo_t) + 64);
You can do that if you use the lltype.GcStruct type directly, not
using "regular" RPython code. See the main example in
rpython
Thanks, I'll check it out.
On Tue, Oct 30, 2018 at 1:58 AM Armin Rigo wrote:
> Hi Timothy,
>
> On Tue, 30 Oct 2018 at 00:42, Timothy Baldridge
> wrote:
> > typedef struct foo_t {
> > int a, b;
> > int _data[0];
> > }
> >
> > foo_t tmp = malloc(sizeof(foo_t) + 64);
>
> You can do that if you use