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

C++ Typing error #38

Open
OvermindDL1 opened this issue Dec 27, 2017 · 1 comment
Open

C++ Typing error #38

OvermindDL1 opened this issue Dec 27, 2017 · 1 comment

Comments

@OvermindDL1
Copy link

As referred to from: viebel/klipse#300

Code that is invalid and should not compile is instead being executed and run up until the point in the source code that it fails.

The linked issue contains of note:

I was attempting to demonstrate C++ type errors that happen at compile time in a demonstration post using klipse, however the typing error seemed to happen at run-time instead of parsing/compilation time as prior lines of code were run and output information before the typing error was hit, which completely destroyed my argument for C++ that catching type errors at compile-time prior to run-time helped prevent classes of errors before the code is executed. ^.^;

Just go to any of the C++ fields at: http://blog.overminddl1.com/posts/programming-language-differences-compilation/

Then input:

#include <iostream>
using namespace std;
int main() {
  char *hw = "Hello World!";
  cout << hw << endl;
  cout << 2 * hw << endl;
  return 0;
}

I'd expect it to just print out:

6:11 unsigned int does not support * on char[13]

Instead it prints:

Hello World!

6:11 unsigned int does not support * on char[13]
@felixhao28
Copy link
Owner

That's why JSCPP is called an interpreter. It can only detect grammar errors prior to execution.

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

No branches or pull requests

2 participants