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

WASM “if...else” doc: What happens if the value is not 0 or 1? (incomplete information) #20193

Closed
AntonioNoack opened this issue Sep 1, 2022 · 1 comment · Fixed by #33959
Assignees
Labels
Content:wasm WebAssembly docs help wanted If you know something about this topic, we would love your help!

Comments

@AntonioNoack
Copy link

MDN URL

https://developer.mozilla.org/en-US/docs/WebAssembly/Reference/Control_flow/if...else

What specific section or headline is this issue about?

The description

What information was incorrect, unhelpful, or incomplete?

It is not explained what happens if the value is not 0 or 1.
Often, null checks are practical, and in low level languages like C, it is ok to write if(ptr) ...

Is this allowed in WASM, or undefined behavior?

What did you expect to see?

The answer that it is allowed.
To quote from the specs:

If c is non-zero, then Execute the block instruction instr_1
Else Execute the block instruction instr_2

Section 4.4.8.5. of https://webassembly.github.io/spec/core/bikeshed/#control-instructions%E2%91%A4

Do you have any supporting links, references, or citations?

https://webassembly.github.io/spec/core/bikeshed/#control-instructions%E2%91%A4

Do you have anything more you want to share?

No response

MDN metadata

Page report details
@github-actions github-actions bot added Content:wasm WebAssembly docs needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. labels Sep 1, 2022
@sideshowbarker sideshowbarker changed the title What happens if the value is not 0 or 1? (incomplete information) WASM “if...else” doc: What happens if the value is not 0 or 1? (incomplete information) Sep 3, 2022
@sideshowbarker sideshowbarker added help wanted If you know something about this topic, we would love your help! and removed needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. labels Sep 3, 2022
@MendyBerger MendyBerger self-assigned this Jan 29, 2023
@hamishwillee
Copy link
Collaborator

@AntonioNoack Sorry for the very long delay - you were absolutely right. Fixed by #33959

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:wasm WebAssembly docs help wanted If you know something about this topic, we would love your help!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants