-
Notifications
You must be signed in to change notification settings - Fork 29
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
Allow compiling the gem with MSVC (which is not C99 compliant) #43
base: master
Are you sure you want to change the base?
Conversation
* Do not use Variable-length arrays (VLA) but instead use a heap array with malloc & free * Redefine a macro
Benchmarked on linux after changes to see impact of these changes: develop: 0.097458 jaro_winkler (9e1d7a0) 0.097458 0.000000 0.097458 ( 0.097460) Had to remove 22a60aa (which was a commit where I tried to remove the |
Hum I guess an alternative is to declare the arrays as fixed size, large enough.
|
alloca seems to work, but haven't tested on MSVC jaro_winkler (12dc642) 0.108995 0.000000 0.108995 ( 0.108998) |
I realize this is probably a corner case (using MSVC to compile a ruby gem), but that's he situation I am in: I have to use MSVC to compile this gem as we have a C++ application that has to be built on MSVC and one thing it does is to create a CLI based on ruby and embedded some gems.
The fun stuff is that MSVC (including the 2019 16.5.1 that I use which is fully up to date) isn't C99 compliant, it's C89 compliant. So in order to be able to build the C extension in this repo, I had to do the following changes:
Edit: Well actually, what a coincidence, I see this PR actually fixes an open issue. Fix #41