Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request: Pragma to specify the alignment of object fields #1930

Closed
gmpreussner opened this issue Jan 11, 2015 · 1 comment · Fixed by #12643
Closed

Request: Pragma to specify the alignment of object fields #1930

gmpreussner opened this issue Jan 11, 2015 · 1 comment · Fixed by #12643

Comments

@gmpreussner
Copy link
Contributor

I was looking for something like {.align: 8.} to override how fields in an object are packed in memory, but couldn't find anything. I'm currently creating some bindings for C library that make heavy use of align().

Example:

type Foo {.align: 8.} = object
  x: int
  y: int

Or maybe we can reuse the {.packed.} pragma for that.

@Araq
Copy link
Member

Araq commented Jan 11, 2015

Is there a C library left that's not full of junk? ;-)

Anyway if you write the wrapper to use header and importc for the fields, you don't have to replicate the alignment instructions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants