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

Strict mode #1659

Closed
victorsand opened this issue Sep 24, 2013 · 6 comments
Closed

Strict mode #1659

victorsand opened this issue Sep 24, 2013 · 6 comments
Labels

Comments

@victorsand
Copy link

Hi, friends!

It seems like Emscripten does not output strict mode compatible code (testing test/hello_world.cpp etc). Is this correct and if so, are there ways to compile to strict mode compatible code?

I dug around in the src and it seems like commented "use strict" directives started showing up in some files, for example in the commit https://github.com/kripken/emscripten/blob/d2b0d9924aa9a3603b0b16bd957832faf503c32d/src/compiler.js (various fixes from js strict mode testing).

Thanks,
Victor

@ngld
Copy link
Contributor

ngld commented Sep 24, 2013

AFAIK it's not possible to generate strict mode compatible code because the framework used during runtime isn't strict mode compatible. (i.e. it uses octal literals)
The file you referenced isn't compiled code but part of the compiler. The directive is commented out because even that file isn't strict mode safe; it uses if() statements to declare functions depending on whether it's run using node.js, as part of a website, in a web worker or a js shell.
It's not possible to generate strict mode compatible code with emscripten without putting a considerable effort into rewriting relevant parts of the compiler.

@victorsand
Copy link
Author

Thanks for your answer, ngld!

@ngld
Copy link
Contributor

ngld commented Sep 24, 2013

You're welcome. =)

@kripken
Copy link
Member

kripken commented Sep 24, 2013

I also think it would take some work, but I am not sure how much. Would be interesting if someone tried.

@VirtualTim
Copy link
Collaborator

(i.e. it uses octal literals)
Octal literals are now allowed in strict mode (with 0o prefix).

@stale
Copy link

stale bot commented Feb 25, 2020

This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 7 days. Feel free to re-open at any time if this issue is still relevant.

@stale stale bot added the wontfix label Feb 25, 2020
@stale stale bot closed this as completed Mar 3, 2020
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

4 participants