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

C4244 compiler warnings: type conversions causing possible loss of data #3

Open
xthdraft opened this issue Nov 14, 2018 · 0 comments
Open

Comments

@xthdraft
Copy link

As pointed out in a closed issue, compiling for electron using:
node-gyp rebuild --target=3.0.6 --arch=x64 --dist-url=https://atom.io/download/electron
causes many C4244 warnings.

These seem benign, as the compiler does implicit type conversions.
I nevertheless suppressed these warnings by using casts in the code for node-stringbuilder.c
eg: buffer[resultListLength++] = (uint32_t)starePointer + 1; // approx line 73
buffer[resultListLength++] = (uint32_t)starePointer + 1; // approx line 133
buffer[resultListLength++] = (uint32_t)sourcePointer + 1; // approx line 250
int64_t log2Floor(int64_t n) {return (int64_t) (floor(log2((double)n))); // approx line 488
int64_t addedLength = (int64_t) pow((double)2, (double)(i - 1)) * contentBufferLength; // 848
int64_t realAddedCount = (int64_t)pow((double)2, (double)log2Count); // approx 851
int64_t addedLength = (int64_t)pow((double)2,(double)( i - 1)) * originalLength; // approx 1188
int64_t realAddedCount = (int64_t)pow((double)2, (double)log2Count); // approx 1191

But these explicit casts are probably not necessary, and whether they'd impact on performance anyway I'm not sure.

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

No branches or pull requests

1 participant