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

[stdlib] Deprecate .unsafe_cstr_ptr() #3638

Open
wants to merge 23 commits into
base: nightly
Choose a base branch
from

Conversation

martinvuyk
Copy link
Contributor

@martinvuyk martinvuyk commented Oct 10, 2024

Deprecate .unsafe_cstr_ptr(). Closes #3601

Signed-off-by: martinvuyk <martin.vuyklop@gmail.com>
@martinvuyk martinvuyk requested a review from a team as a code owner October 10, 2024 14:55
Signed-off-by: martinvuyk <martin.vuyklop@gmail.com>
Signed-off-by: martinvuyk <martin.vuyklop@gmail.com>
Signed-off-by: martinvuyk <martin.vuyklop@gmail.com>
Signed-off-by: martinvuyk <martin.vuyklop@gmail.com>
@soraros
Copy link
Contributor

soraros commented Oct 10, 2024

Thank for the cleanup! You may also want to add fix #3601 to the description.

Signed-off-by: martinvuyk <martin.vuyklop@gmail.com>
Signed-off-by: martinvuyk <martin.vuyklop@gmail.com>
@yinonburgansky
Copy link
Contributor

cstr_ptr != char_ptr

  • cstr_ptr is null terminated
  • char_ptr is not necessarily null terminated.

there could be types which need to add a null terminator.

@martinvuyk
Copy link
Contributor Author

Hi @yinonburgansky I undestand your points, but that is what it means to work at an ABI level. Whoever uses sys.ffi knows that all operations are unsafe, it is their responsibility to know where and how pointers are coming in and out and ensure whatever "safety" can be obtained.

Beyond the philosophical debate of what safety level we should guarantee, reducing the public API surface area of unsafe operations should be a goal i.e. having less of these .unsafe...() functions. And this adds to that which I think is best in the long run.

martinvuyk and others added 11 commits October 11, 2024 15:38
Signed-off-by: martinvuyk <martin.vuyklop@gmail.com>
Signed-off-by: martinvuyk <martin.vuyklop@gmail.com>
Signed-off-by: martinvuyk <martin.vuyklop@gmail.com>
Signed-off-by: martinvuyk <martin.vuyklop@gmail.com>
Signed-off-by: martinvuyk <martin.vuyklop@gmail.com>
Signed-off-by: martinvuyk <martin.vuyklop@gmail.com>
Signed-off-by: martinvuyk <martin.vuyklop@gmail.com>
Signed-off-by: martinvuyk <martin.vuyklop@gmail.com>
Signed-off-by: martinvuyk <martin.vuyklop@gmail.com>
Signed-off-by: martinvuyk <martin.vuyklop@gmail.com>
martinvuyk and others added 2 commits October 16, 2024 11:05
Signed-off-by: martinvuyk <martin.vuyklop@gmail.com>
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.

4 participants