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

Make grow strategy per vector instead of global #60

Closed
wants to merge 2 commits into from

Conversation

yiselieren
Copy link

  1. Make grow strategy local per vector instead of using it globally
  2. Add cast in cvector_reserve allowing to use signed integers as a parameter of the macro

@eteran
Copy link
Owner

eteran commented Mar 13, 2024

Sorry for the delay on this. I'm somewhat torn on this PR. I can definitely see the utility of it, sometimes you want your vector to grow incrementally, sometimes you want it to double, maybe you even what a 3rd option.

But...

On the other hand, usually I've found that one or the other is just generally right for the current system. Heck c++ doesn't even give you an option, it's just left up to the implementation to decide. And honestly, there's been a bit of feature bloat already with the destructor stuff. So I'm not sure I want to add yet another feature for a niche usage.

So, I'll think on it.

All of that being said, if you still are interested in it being merged, please ensure that it passes the clang-tidy check above as I'd prefer to merge PRs as is and you'll also need to add the new parameter to test.c so it passes the build again.

Sorry it took so long to respond to this, and that I allowed your PR to get stale while a few others merged and conflicted.

@@ -228,45 +241,31 @@ typedef struct cvector_metadata_t {
#define cvector_end(vec) \
((vec) ? &((vec)[cvector_size(vec)]) : NULL)

/* user request to use logarithmic growth algorithm */
#ifdef CVECTOR_LOGARITHMIC_GROWTH
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could likely retain backward compatibility by using this define to determine the default growth behaviour.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed

@eteran
Copy link
Owner

eteran commented May 22, 2024

Unfortunately this PR has fallen too far behind master to really bring up to date. if the OP wants to re-introduce it, please open a new PR based on the latest code.

@eteran eteran closed this May 22, 2024
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.

None yet

3 participants