Skip to content

Translate C99 flexible array member - #473

Merged
nunoplopes merged 7 commits into
Cpp2Rust:masterfrom
lucic71:9-flexible-array-member
Oct 8, 2026
Merged

nunoplopes merged 7 commits into
Cpp2Rust:masterfrom
lucic71:9-flexible-array-member

Conversation

@lucic71

@lucic71 lucic71 commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@nunoplopes

Copy link
Copy Markdown
Contributor

The refcount translation is very weird. How come a malloc can work through the Rc/RefCell/Box?

I suspect if you add an example that accesses an array with 8 elements, it will crash.

@lucic71

lucic71 commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

The refcount translation is very weird. How come a malloc can work through the Rc/RefCell/Box?

Malloc returns an array of bytes which is reinterpreted as F. ByteRepr builds an F using the bytes and from that point on it's just a reinterpreted pointer. There is nothing wrong with that.

I suspect if you add an example that accesses an array with 8 elements, it will crash.

I added

@nunoplopes
nunoplopes merged commit 521db4b into Cpp2Rust:master Oct 8, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants