-
Notifications
You must be signed in to change notification settings - Fork 140
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
unsafeUseAsCString(Len) may return a NULL pointer. #674
Comments
There is already a remark on this in the docstring for I'm not sure there's much more that can reasonably be done here. But feel free to re-open if you have ideas. |
It's on unsafeUseAsCStringLen but the remark is not on unsafeUseAsCString There is a shared remark, and different ones. It's hard to know which ones are actually shared (all of them, none?). The documentation is not clear there. |
Ah. And yet remarking about |
Why? unsafeUseAsCString doesn't do any null-termination, does it? |
Yes, exactly. |
But i'm not talking about null-termination, I'm talking that the pointer itself returned may be I expect to see -- If 'Data.ByteString.empty' is given, it will pass @'Foreign.Ptr.nullPtr'@. for Also is it then a bug that |
I mean that a call
We make no guarantees about what underlying pointer is used in the empty result of |
it might be, but it's irrelevant to this documentation issue. (The code I work one calls |
Then the remark about |
While generally this behavior is fine, it probably should be documented, as it might surprise someone (it did surprise me).
In haskellari/postgresql-libpq#54,
libpq
differentiates betweenNULL
pointer, and a pointer with data length zero.The text was updated successfully, but these errors were encountered: