-
Notifications
You must be signed in to change notification settings - Fork 182
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
type of calloc in stdlib_checked.h #413
Comments
Here, the type of
And we hit the following condition in On relaxing this condition for @dtarditi Could you please comment on what the intended behavior should be in this case? |
Mike, If we re-write |
I can't think of a better solution. What will you call it? |
Has this been implemented? Right now I am trying to allocate memory for an nt_array of variable length. There doesn't seem to be a way to do that right now. |
In
stdlib_checked.h
the functioncalloc
is defined thus:but this type fails to recognize that since the returned memory is zeroed out, we can treat the buffer as an
_Nt_array_ptr
instead. Would the following type be acceptable?I tried to use this type and the compiler rejected it, saying
Another problem I can see is that a normal array pointer would be allocated as an NT array pointer first, which could then be cast to the normal one. But doing so would cause the length to drop by one. I.e., a
_Nt_array_ptr<char> : count(3)
actually represents a buffer of size 4, but you can only cast it to_Array_ptr<char> : count(3)
so that the alias cannot be used to destroy the 0 terminator.The text was updated successfully, but these errors were encountered: