-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Flip some negated #if checks. NFC
#25487
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
Conversation
| warn('To build in STANDALONE_WASM mode without a main(), use emcc --no-entry'); | ||
| } | ||
| } | ||
| if (!RELOCATABLE) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OTOH, "not relocatable == normal", and it's nice to have the normal path first? Then reading the more complex relocatable one after is easier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one has annoyed me for a while. Every time I read I feel like have to do mental work for some reason.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the negation here is annoying, how about var ABSOLUTE = !RELOCATABLE or some better name for "simple, absolute-addressed single file with no linking involved" - ?
(Perhaps "linked file", "relocated file", "flat file" - maybe there is a good term?)
That would avoid the negation, and also let us keep having the simple code first in each such if-else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually in this case I like the if RELOCATABLE.
The code here is part of the undefined symbol handling. Its within a block and its already an error in most cases.
It reads like this:
if (is_undefined) {
maybe_report_an_error();
// Here we are continuing with the undefined symbol
if (RELOCATABLE) { // AKA dynamic linking
create_a_dylink_stub();
} else {
create_an_abort_stub();
}
}
I think this is more logical that the other way around:
if (is_undefined) {
maybe_report_an_error();
// Here we are continuing with the undefined symbol
if (!RELOCATABLE) {
create_an_abort_stub();
} else {
create_a_dylink_stub();
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough, I can live with this one. Reading the others again now.
| // regarding this function, marking ot a variadic function that can take in anything and return anything. | ||
| // (not useful to warn/error multiple times) | ||
| LibraryManager.library[symbol + '__docs'] = '/** @type {function(...*):?} */'; | ||
| isStub = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just noticed the isStub = true; is repeated in both condition here too
828c25f to
5977f9e
Compare
This helps with readability IMHO since you don't need to do a double negative when considering the `#else` block.
5977f9e to
ba08f70
Compare
|
Ok to land? |
This helps with readability IMHO since you don't need to do a double negative when considering the
#elseblock.