the.bay.news

Requiring a fixed position of one field in a struct without extern

Ziggit
Requiring a fixed position of one field in a struct without extern
I need a field to be the the very first field of a struct for use with things like GS relative addressing on x86 but have no other layout requirements on the struct. The obvious solution is to just use an extern struct but that forces C compatible types for all other fields: pub const Cpu = extern struct { // must be the first field `@intFromPtr(&cpu) == @intFromPtr(&cpu.self) == @intFromPtr(cpu.self)` self: *Cpu, // the rest of this struct has no need to be extern and wants to co...

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.