C++ Playground on iPhones and iPads
Thank you so much for purchasing this application. We hope that you will find the tool useful and will enjoy using it.
L* C++ is an C++ integrated development environment iOS app. In other words, it allows you to write C++ programs, gets them executed (technically, interpreted) and see the output.
Our main audiences are students learning to program and developers writing back-end utility libraries such as those to perform computation in algebra, statistics and data compression, to train artificial intelligent model, etc. as opposed to GUI-based applications.
Compared to similar tools in the market, L* C++ is
The project's Overview tab loads the project documentation (like this page) in doc/index.html
. You can put all the required resources (images, CSS) there.
On the related topic, it is best to organize your projects like many open source community, namely into directories such as
src
for private headers and implementations,include
for public headers (your API),data
for program data, models, ...In traditional C++ development environment, you can split a program into multiple source files, say a.cpp
and b.cpp
. Then you compile them into separate object files a.o
and b.o
and then link them into an architecture-dependent (ARM, x86, ...) executable, say myprogram
that could be executed in the Terminal by typing ./myprogram
.
At this first release, L* C++ could not perform linkage and iOS also disallows execution of native programs. So we actually interpret C++ program instead of performing the traditional compilation-linkage. In other words, we are executing the C++ code line-by-line whereas the executable is a binary file containing instructions that could be executed by the CPU directly. That means for now, we cannot support multiple source files and so you need to #include
all source into a single program. For instance, if you want to run the program a.cpp
that has some function implemented in b.cpp
, you must add #include "b.cpp"
in the file a.cpp
.
We are sorting out the right user interface for all the required customizations akin to Xcode build targets and schemes.
The standard output is the most fundamental form of output for command lines program: to print out textual messages to communicate with the user. Our app supported this via a limited implementation of C++ std::cout
(it does not work with std::string
yet but does work for many other common types). Standard C API such as printf
will not work and since it is a good coding practice to avoid printf
for security reason, we do not intend to support it in the future.
See our "Hello World" program hello.cpp for an example.
You can use a majority of the standard C APIs in your app such as those involving math, string manipulation, memory allocation, memory copy and initialization, random number generation, etc. The one you cannot use are
qsort
and bsearch
declared in the C header stdlib.h
(but note that there are better alternatives for these particular functions in C++ standard template library algorithm) as well asFILE
due to iOS sandbox limitations and security restrictionssetjmp
.In the future, we will attempt to port fstream
in C++ standard library for file I/O.
For C++ standard template library, we supply libc++ from the LLVM project but our knowledge of its implementation is limited.
vector
, map
, set
, linked_list
and the like) should work properly; as are standard container algorithm
.string
methods do not (namely, less than comparison and related operators) while all other string
methods do.
stream
does not work due to dependency on some locale
code. But we provide a temporary implementation of std::cout
for output.atomic
, condition_variable
, future
, mutex
, thread
) are definitely not available until we port them. Nevertheless, they are not relevant since our goals are single threaded programs.There are several other limitations in the current release that you should be aware of
This Getting Started project includes several example programs to illustrate the capability of our C++ interpreter:
hello.cpp
: Classical "Hello World" program.fibonacci.cpp
: Elementary program to produce Fibonacci numbers.polymorphism.cpp
: Polymorphism in C++ Object-Oriented Programming.functional.cpp
: Templates and Functional Programming in C++ language.math.cpp
: Examples of standard mathematical functions.prng.cpp
: Random number generation.string.cpp
: Illustrations of null terminated C strings and std::string
.sort.cpp
: Using C++ STL to sort a container.permutations.cpp
: Using C++ STL to enumerate permutations.This app does not collect any user information. All your files belong to you.