Skip to content

saner parameter order for reallocation functions #17870

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

Merged
merged 1 commit into from
Oct 9, 2014
Merged

saner parameter order for reallocation functions #17870

merged 1 commit into from
Oct 9, 2014

Conversation

thestinger
Copy link
Contributor

Using reallocate(old_ptr, old_size, new_size, align) makes a lot more
sense than reallocate(old_ptr, new_size, align, old_size) and matches up
with the order used by existing platform APIs like mremap.

Closes #17837

[breaking-change]

@rust-highfive
Copy link
Contributor

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!

Using reallocate(old_ptr, old_size, new_size, align) makes a lot more
sense than reallocate(old_ptr, new_size, align, old_size) and matches up
with the order used by existing platform APIs like mremap.

Closes #17837

[breaking-change]
bors added a commit that referenced this pull request Oct 8, 2014
Using reallocate(old_ptr, old_size, new_size, align) makes a lot more
sense than reallocate(old_ptr, new_size, align, old_size) and matches up
with the order used by existing platform APIs like mremap.

Closes #17837

[breaking-change]
bors added a commit that referenced this pull request Oct 9, 2014
Using reallocate(old_ptr, old_size, new_size, align) makes a lot more
sense than reallocate(old_ptr, new_size, align, old_size) and matches up
with the order used by existing platform APIs like mremap.

Closes #17837

[breaking-change]
bors added a commit that referenced this pull request Oct 9, 2014
Using reallocate(old_ptr, old_size, new_size, align) makes a lot more
sense than reallocate(old_ptr, new_size, align, old_size) and matches up
with the order used by existing platform APIs like mremap.

Closes #17837

[breaking-change]
bors added a commit that referenced this pull request Oct 9, 2014
Using reallocate(old_ptr, old_size, new_size, align) makes a lot more
sense than reallocate(old_ptr, new_size, align, old_size) and matches up
with the order used by existing platform APIs like mremap.

Closes #17837

[breaking-change]
@bors bors closed this Oct 9, 2014
@bors bors merged commit 1c6fd76 into rust-lang:master Oct 9, 2014
@renato-zannon
Copy link
Contributor

It might make sense to add some kind of warning to calls to reallocate for some time, because the old calls continue to typecheck, and will be silently wrong (until it fails to allocate). I only realized I had to change my code because I was randomly browsing this repo's log

@thestinger thestinger deleted the alloc branch October 10, 2014 14:26
@thestinger
Copy link
Contributor Author

@renato-zannon: It's already marked as #[experimental] to indicate that it's in flux and it's probably not done changing. It's marked as [breaking-change] in the commit message too.

@renato-zannon
Copy link
Contributor

Sure, I meant just as a nicety to callers whose code suddenly starts to break :p But maybe this API is too niche/low-level to be worth it, there are very few calls to it in the stdlib.

It's probably not done changing

I will take greater care then, thanks!

@thestinger
Copy link
Contributor Author

It may take a parameter for providing the currently used size in the future. It might also allow specifying a new alignment rather than forcing it to be the same. It could also be a convenience wrapper though around functions with more parameters though... don't know at this point.

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.

use saner parameter order for reallocate / reallocate_inplace
4 participants