no2chem / bigint-buffer

💪🔢 bigint-buffer: Buffer Utilities for TC39 BigInt Proposal
Apache License 2.0
54 stars 11 forks source link

Windows support #16

Closed ghidosoft closed 4 years ago

ghidosoft commented 4 years ago

This PR adds Windows support, now compilation runs fine and should still run fine also on GCC.

I also updated microtime to 3.0.0 to allow Windows installation of dev dependencies, I changed a little the compile scripts in package.json, it should work in both platforms.

Tests are all green under Windows 10.

fixes #14

no2chem commented 4 years ago

@ghidosoft Thanks! It looks like the tests are failing, but it seems that the error might not be coming from your changeset. I haven't looked at this recently, but I'll see if some node change caused the problem...

ghidosoft commented 4 years ago

Yes, I looked into it but I could not point out the cause, I could not reproduce the error on my (Windows) machine.

https://github.com/no2chem/bigint-buffer/blob/master/src/index.spec.ts#L194 should be the test that fails but I don't see any difference with the previous tests. @no2chem if you could look into it it would be great, thanks!

ghidosoft commented 4 years ago

@no2chem I think I nailed it. stack_buffer is allocated on the stack but inside an if. After exiting the if that buffer was reused but it's compiler dependent when local variables gets allocated on the stack (i.e. per block or at the beginning of the function). This behavior could be source of subtle bugs like maybe #12

ghidosoft commented 4 years ago

@no2chem I added a Windows test:node to Travis CI and compilation now runs fine even in cmd.exe, let me know if it's ok.