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

Replace SmallStackSafeStackAlloc and AutoFreePtr #7512

merged 2 commits into from Apr 15, 2019


Copy link

@michicc michicc commented Apr 14, 2019

Some more cleanup of home-grown standard functions.

The only port that ever used it to make heap allocations instead of stack ones was the NDS port, which got thrown out some time ago.
Copy link

PeterN commented Apr 15, 2019

Change to std::array now, deal with individual std:: vector cases later? Or is that change for change's sake?

Copy link
Member Author

michicc commented Apr 15, 2019

The only change where std::vector would remotely make sense is the singular use of AutoFreePtr, but an uninitialized chunk of memory is fine there.

Everything else is a simple, static buffer for saveload. A plain old C array would do the trick, but std::array has the option that it might not use the stack on system which are limited (I don't know of any, but except for a few more source code characters, I don't see any disadvantage from using it anyway).

@LordAro LordAro merged commit 3872929 into OpenTTD:master Apr 15, 2019
@michicc michicc deleted the pr/c++11_mem branch April 15, 2019 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

3 participants