Skip to content

Special VDFs to use CustomArg/Result#515

Merged
villagestevers merged 1 commit into
mainfrom
stevers/cpp-calls
May 15, 2026
Merged

Special VDFs to use CustomArg/Result#515
villagestevers merged 1 commit into
mainfrom
stevers/cpp-calls

Conversation

@villagestevers
Copy link
Copy Markdown
Member

Refs #504

Next step - update external repos.
Then remove old signatures/update comments.

Refs #504

Next step - update external repos.
Then remove old signatures/update comments.
Copy link
Copy Markdown
Member

@malone-at-work malone-at-work left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be passing by reference for any of these, mutable or otherwise.

using TypeCompareWithParamsFunc = int (*)(const P &,
Span<const unsigned char> a,
Span<const unsigned char> b);
using TypeCompareWithParamsFunc = int (*)(CustomArgWith<P> a,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be passing these by const reference? or value?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude's analysis:

CustomArg and CustomArgWith

are single-pointer handles — class CustomArg { const vef_invalue_t *v_; } (8 bytes on 64-bit). Pass-by-value is the
right call:

Sized like a pointer, copied like a pointer. They're trivially copyable handle types, not aggregates. By-value lands the pointer in a register;
const& forces the wrapper to live in memory so its address can be taken (which the optimizer usually undoes, but at zero benefit). Same reasoning
std::string_view (16 B) and std::span (16 B) are by-value.

@villagestevers villagestevers merged commit b6d08e8 into main May 15, 2026
3 checks passed
@villagestevers villagestevers deleted the stevers/cpp-calls branch May 15, 2026 14:01
@github-actions github-actions Bot locked and limited conversation to collaborators May 15, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants