Skip to content

Conversation

@sbc100
Copy link
Collaborator

@sbc100 sbc100 commented Dec 14, 2021

I ran into this issue when working on #15763. We have code interally
that converts =-1 to =0x7FFFFFFF for the MIN_XX_VERSION settings.
However, this was then being interpreted interally as a string. When
read from JS there is no differenence but from python code the value of
this setting would appear as the string "0x7FFFFFFF" and not the number
0x7FFFFFFF.

I ran into this issue when working on #15763.  We have code interally
that converts `=-1` to `=0x7FFFFFFF` for the MIN_XX_VERSION settings.
However, this was then being interpreted interally as a string.  When
read from JS there is no differenence but from python code the value of
this setting would appear as the string "0x7FFFFFFF" and not the number
0x7FFFFFFF.
@sbc100 sbc100 enabled auto-merge (squash) December 14, 2021 16:17
@sbc100 sbc100 disabled auto-merge December 14, 2021 16:17
Copy link
Member

@kripken kripken left a comment

Choose a reason for hiding this comment

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

Hmm, what about cases where the user passes in 0x123 but intends that to be a string? I'm not sure I can think of an example, since it must still be a valid hex number... which means it can't be a function name or something like that.

@sbc100
Copy link
Collaborator Author

sbc100 commented Dec 14, 2021

Hmm, what about cases where the user passes in 0x123 but intends that to be a string? I'm not sure I can think of an example, since it must still be a valid hex number... which means it can't be a function name or something like that.

Yes, that is right.. C/C++ symbols can't start with numbers so it can't be function name. Do you know of any other string settings that might want to be passed 0x123 as a string?

I guess the ultimate solution would be categorize the settings into those that take strings vs those that take numbers.... but that seems like a larger change.

@kripken
Copy link
Member

kripken commented Dec 14, 2021

I can't really think of one, so lgtm.

E.g. PTHREAD_POOL accepts a string, and in theory one could give it a hex string. But that would work with a hex number as well. I can't think of a case that can't.

@sbc100 sbc100 merged commit be6444f into main Dec 14, 2021
@sbc100 sbc100 deleted the hex_settings branch December 14, 2021 20:27
mmarczell-graphisoft pushed a commit to GRAPHISOFT/emscripten that referenced this pull request Jan 5, 2022
…15771)

I ran into this issue when working on emscripten-core#15763.  We have code interally
that converts `=-1` to `=0x7FFFFFFF` for the MIN_XX_VERSION settings.
However, this was then being interpreted interally as a string.  When
read from JS there is no differenence but from python code the value of
this setting would appear as the string "0x7FFFFFFF" and not the number
0x7FFFFFFF.
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.

3 participants