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

Operator precedence error with sizeof(void *) #251

Open
finitemonkey opened this issue Apr 16, 2020 · 0 comments
Open

Operator precedence error with sizeof(void *) #251

finitemonkey opened this issue Apr 16, 2020 · 0 comments
Labels

Comments

@finitemonkey
Copy link

finitemonkey commented Apr 16, 2020

The following line (from https://github.com/P-H-C/phc-winner-argon2/blob/master/include/argon2.h);

#define ARGON2_MAX_MEMORY_BITS ARGON2_MIN(UINT32_C(32), (sizeof(void *) * CHAR_BIT - 10 - 1))

is translated into;

enum ARGON2_MAX_MEMORY_BITS = ARGON2_MIN(UINT32_C(32), void*.sizeof * CHAR_BIT - 10 - 1);

Which results in the following error when attempting to compile;

source/argon2.d(53,60): Error: found * when expecting . following void
source/argon2.d(53,61): Error: found . when expecting identifier following void.
source/argon2.d(53,62): Error: found sizeof when expecting ,
/usr/bin/ldc2 failed with exit code 1.

Parentheses around the void* make the compiler happy again! (Presumably a size_t would do the same job here, too?)

dstep: 1.0.1-10-g0f362b8
clang: 7.0.1-8 (tags/RELEASE_701/final)
Compiler: LDC - the LLVM D compiler (1.12.0), based on DMD v2.082.1 and LLVM 6.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants