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

Is there any missing feature of pure C (not C++)? #146

Open
Naereen opened this issue Feb 20, 2021 · 3 comments
Open

Is there any missing feature of pure C (not C++)? #146

Naereen opened this issue Feb 20, 2021 · 3 comments

Comments

@Naereen
Copy link

Naereen commented Feb 20, 2021

Hello there,
First of all, 👏 👏 this project is amazing, I just discovered it, and played for an hour on the online JSCPP interpreter.
It's a great tool for teaching I think! So thanks!

Regarding teaching, I'll have to teach a few introduction courses to C, and of course I'll start by using a local real compiler for C, but I would like to also have such basic environment online, and hosted locally on the machines that my students will use: this way, there is nothing to install, it works on Windows, and no need for Internet access, just a web-browser to a local folder.

I'm not a very strong expert of C and C++, but from what I understood, any valid C99 or C11 program is also valid in C++, with the same semantic, so I can expect JSCPP to be able to run correctly any (small and simple enough) C program?
I saw the list of libraries, and #include <math.h> works, which will be enough for a huge part of my classes.

My question is in the title: Is there any (known) missing feature of pure C (not C++)?

Thanks!
Regards from France, @Naereen

@Naereen
Copy link
Author

Naereen commented Feb 20, 2021

I link here a similar question I've opened on Jupyter notebook kernel for C++, that I also intend to use for my teaching.
jupyter-xeus/xeus-cling#386

@felixhao28
Copy link
Owner

Is there any (known) missing feature of pure C (not C++)?

Actually, there is a lot of missing features:

  1. Most of the headers. Here is a very limited list of currently added headers. Although these headers are enough for my C++ lessons, you might find them not enough. If you need any more, feel free to open a new issue.
  2. JSCPP is an interpreter. Therefore some compile errors will only be reported during execution. So JSCPP is not a good way to teach students what compiling means.
  3. The support for macros is experimental for now.
  4. goto statements.
  5. Embedding assembly.

@Naereen
Copy link
Author

Naereen commented Feb 22, 2021

Hi @felixhao28, thanks for the detailed answer.
At the level I'll be teaching, I can safely assume that macros should be limited, goto forbidden, and assembly completely out-of-scope.
Regarding headers, thanks for the link. I guess for advanced lectures in 2nd semester and beyond, it won't be enough (no assert for instance) but for a start that's really enough.

And you're right to remind that it's an interpreter, but precisely I want to avoid presenting things in binary like "Python is interpreted, C/C++/Java are compiled" (Python has Numba, Pypy with JIT, Cython ; C/C++ have well your project, CLING and a CLING kernel for Jupyter, Java have JShell and IJava for Jupyter).
Of course after one lecture explaining all this I'll dive in the "classical" way of using these languages, with clang/gcccompiler for C/C++, javac/java for Java, and CPython interpreter for Python.

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