Lua, threads and C++ exceptions [closed] - c++

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I'm planning on suggesting to my development team that we start looking at lua instead of C++ for the project we're currently working on. On that subject I have a question that I need to clear up first.
With the current SDK, we are not allowed to use C++ exceptions due to it not being safe in multithreaded applications (created with that SDK). Actually, it is allowed, just discouraged... however the program won't compile unless we pass -fno-exceptions, so... yeah...
Anyway. Since Lua runs in it's own VM and is pure C... Would exceptions in Lua be 'safe'?

If the C code that makes up the LUA interpreter is fine concerning the restrictions of your SDK then anything coded in LUA and executed with that interpreter is fine, too. But if the LUA interpreter itself is working with your unnamed SDK... that's a question that only you or the SDK vendor can answer.

Related

Is calling C++ code from Swift more "expensive" or slower than calling C code? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I have never tried Swift but my research suggests that callling pure C code is simpler than calling C++ code.
Does this mean that there are associated performance impediments and, if so, how significant are they?
Swift has no C++ interop at present. That means you either have to create a C or Objective-C++ wrapper around your C++ classes in order to bridge them to Swift.
In practice this is very unlikely to have a performance impact - it'll add another method call using VTABLE dispatch that in turn calls the C++ method. It does, however, create a lot more manual work that needs to be done in order to use your C++ code-base in Swift.

Embedding shell scripts in another language? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
Is it possible to embed shell scripts into a higher-level programming language, for example, C++?
How would one go about doing that? For example, do you just place the script somewhere in the C++ code and the compiler is able to understand the script and the C++ code too?
Can you embed shell scripts into higher-level languages ?
Answer: Yes
You can always use the system api calls to execute any command and hence any shell script.
In C++, you can call the system function, like
#include<cstdlib>
system("myShellScrit.sh");

Do i need to learn c before learning c++? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I started to learn C, but I realized that all i could do was to build thse console programs (correct me if i'm wrong). So, i've seen that c++ is much more "graphic", like, you can build apps and windows, and is also OOP, what makes everything easier. So, do I need to finish learning c before c++?
Also, what interested me about C was that I could program an Arduino. Can I program an Arduino with C++?
All the "graphic" things are supported by libraries, no matter in C(e.g. GTK, SDL) or C++ (e.g. QT).
And for hardware drive programming, no matter what language it is. You have to compile it into binaries so that the hardware will knows how to run. You can even create your own language if you can write your own compiler.

Programatically creating and compiling from a program in C++ [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Let's say we've got a first program called Program1.exe which contains the necessary information to create and compile another application called Program2.exe. Actually it could also load that information from a txt file or whatever.
Googling, I've found that this is "easy" to do in C#, using Visual Studio:
How to programatically build and compile another c# project from the current project
Programmatically Invoke the C# Compiler
The problem is that I'm not using (and can't use) C#, but C++. Summing it up, my question is if that I can do this same thing using C++.
I would prefer to do it without additional libraries, but if that's not possible, or if it's too hard to do, you can also recommend any library allowing it.
I think you'll probably have noticed it, but my goal is to use it under Windows so I don't care if it's not portable.
Thanks everybody.
It's trivial (if maybe a bit odd) for a C++ program to compile and run another based on code stored in a text file. Debugging that other program, however, isn't.

How to output to console window without iostream in c++? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm a beginner C++ programmer.I would like to know that Is it possible to output to console windows without using iostream header file?
the answer of the question is actually Yes ! but How?
You can always delve down to the C library level, using e.g. printf.
If you don't want to use the standard library at all then you have to use platform-specific functionality. In Windows there are many layers here, much like the C++ versus C layers in the standard library. The highest Windows API layer is the WriteFile function, and below that, WriteConsole, then perhaps WriteConsoleOutput, so on, check it out.
Note that there are at least two open source projects to provide more reasonable console functionality in Windows, namely Console2 at SourceForge and mintty at Google Code.