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

Documentation not clear on whether ncselector_item is copied or referenced by ncselector_additem #2829

Open
slashdevslashurandom opened this issue Jan 2, 2025 · 1 comment
Assignees
Labels
bug Something isn't working documentation Improvements or additions to documentation
Milestone

Comments

@slashdevslashurandom
Copy link

Notcurses version: 3.0.11, but also applies to the website

When reading the documentation for notcurses_selector(3), it was not clear to me whether or not the ncselector_item structures used by ncselector_additem were only used for their values (the name and description were to be copied) or were referenced outright, requiring the caller to keep track of the structure in the future. Only upon reading the source code of the library was I able to verify that this is the former.

Perhaps the description could be clarified by stating something like "The ncselector_additem function does not create an extra reference to the item argument's structure, allowing it to be erased or reused for other items later."

@slashdevslashurandom slashdevslashurandom added the bug Something isn't working label Jan 2, 2025
@slashdevslashurandom
Copy link
Author

Perhaps the same could be done with the items array in the ncselector_options struct used for ncselector_create -- as its contents are also copied into the actual selector's structure, and the fact its defined as a struct ncselector_item* without any const qualifiers makes it seem even more as if its contents are referenced, rather than copied.

@dankamongmen dankamongmen self-assigned this Jan 11, 2025
@dankamongmen dankamongmen added the documentation Improvements or additions to documentation label Jan 11, 2025
@dankamongmen dankamongmen added this to the 3.1.0 milestone Jan 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants