-
Notifications
You must be signed in to change notification settings - Fork 1
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
Using stdlib functions in a ctor potentially unsound #28
Comments
Dear IDS, you are entirely right. However I honestly don't see a way around it. The crate which "defines" the label stores all the references to the functions annotated with the label, and we can't know in advance how many times the annotation will be used (so we need to use vec). The only reason around this is by limiting ourselfs to libc functions. Calling libc's malloc directly and implementing some sort of custom vec-like structure. Do you know of a better way to do this? |
It's rather annoying to have to do it this way, but it shouldn't be to hard to wrap
Maybe there's a better way to implement something like this, but unfortunately I don't know what it is. |
The unfortunate thing about using a fixed size array is that it'd either make a huge empty array in the binary (every label you create will equal an array of |
Also, may I say that I am not sure if this library is fit to be used with gtk_rs as it depends on a nightly feature. I'm not entirely sure you want that. Unfortunately that's another thing I haven't found a way around yet. I need to find the path to the label definition which I can only find by parsing some of the source around the labelled function. It doesn't look like this will be stable any time soon. |
According to the README for ctor:
Looking at the generated code, this seems to use
Vec
in the constructor. As I understand the statement fromctor
above, this could potentially segfault or be otherwise broken by a future change to std, or on a particular target, or perhaps with custom allocators.The text was updated successfully, but these errors were encountered: