# translate-c: add limited OffsetOfExpr support · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/294ee1bbc93a00ead5182234f824b0a665c579d9)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 294ee1bbc93a00ead5182234f824b0a665c579d9

Requested commit: 294ee1bbc93a00ead5182234f824b0a665c579d9

Commit: 294ee1bbc93a00ead5182234f824b0a665c579d9

Tree: 2938d0ebf9309bfbef8021bad0fbf9d6a7b5fd76

Author: Evan Haas

Committer: Veikka Tuominen

## Message

````
translate-c: add limited OffsetOfExpr support

Add support for OffsetOfExpr that contain exactly 1 component, when that component
is a field.

For example, given:

```c
struct S {
  float f;
  double d;
};
struct T {
  long l;
  int i;
  struct S s[10];
};
```

Then:
```c
offsetof(struct T, i)       // supported
offsetof(struct T, s[2].d)  // not supported currently
```

````

## Parents

- [0423f0f7d8afc24e48926849515f60a8a3a1e470](https://git.cafe/gitcafe/zig/commit/0423f0f7d8afc24e48926849515f60a8a3a1e470?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/294ee1bbc93a00ead5182234f824b0a665c579d9?format=markdown)
