Skip to content

Fix translation of nullptr creation and comparison#81

Merged
nunoplopes merged 6 commits into
Cpp2Rust:masterfrom
lucic71:nullptr
May 12, 2026
Merged

Fix translation of nullptr creation and comparison#81
nunoplopes merged 6 commits into
Cpp2Rust:masterfrom
lucic71:nullptr

Conversation

@lucic71
Copy link
Copy Markdown
Contributor

@lucic71 lucic71 commented May 12, 2026

This PR translates default pointers using GetDefaultAsString, resulting in Ptr::<T>::null() being generated instead of Default::default(). This is useful for contexts where Default::default() cannot be correctly deduced as a Ptr.

Pointer comparisson is also fixed to allow C NULL comparissons such as p != NULL or p != 0.

@nunoplopes nunoplopes merged commit 7cfa0e0 into Cpp2Rust:master May 12, 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