How is visual programming using nodes and links converted into code? [closed] - c++

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 4 years ago.
Improve this question
as title says, i want to know what is logic behind visual programming and how is it being converted into code?
Use for example unreal engine 4 blueprints, how it all works behind scenes?
I somehow think everything is made using linked structures with pointers... For example:" if " statement needs link of statement and to output links, wether that statement is true or false... But if we do all like that, programming every keyword seperatly, i think it would take too much time.
I hope you understand what im thinking.
I would from the point of view of c++ explaination if possible..

Usually data flow graphs are not converted into C, C++ or similar before being compiled. A visual representation of a data flow graph is much closer to an Abstract Syntax Tree (AST) than written programming language code.
In fact, for most programming language compilers among the first steps carried out is the translation of a the written code into an AST, and it's a trivial task to feed such a AST into a program like graphviz to generate a call graph or similar from it.
So in a sense, that data flow graph of Unreal, or LabVIEW or similar programming environments is already one step closer to the executable code. Hence regarding your questions it's better suited to reformulate it as "how is written programming language parsed and translated into a data flow graph – like you can draw in Unreal engine – or an AST?".
Unfortunately the answer to this would go vastly beyond the scope of StackOverflow, and I'll simply refer you to the standard literature on compiler development.

Related

What piece of hardware or software on a computer/microcontroller determines what code you can write (and not write)? [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 11 months ago.
Improve this question
So I am writing code for a microcontroller (using Arduino IDE), which I do not have a ton of experience doing. This question popped into my head when I was wondering which 'parts' of C++ I could use in my code that would flash onto this NRF52840 microcontroller. Basically, I am wondering: What on that board determines the code I must write for it?
I understand saying "what code can I write/not write" is broad, but its because I dont know what to say instead. A few guesses I have for substitutes for this would be: certain libraries? certain coding languages?, certain types of languages (interpreted vs compiled)?
Sorry if this question is too horribly stated to get an answer, but this was legit the best I could do lol.
In the case of using C++, it depends entirely upon what language features the compiler you are using supports. I suppose there might be hardware out there that is so simplistic that certain features are simply beyond the ability to implement, but I cannot tell you either what hardware that is, or what language features would be so effected.

which one between " c or c++ " should I learn for beginner for to use Arduino UNO? [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 3 years ago.
Improve this question
I want to learn how to use Arduino, but it needs some code and there are 2 different options are c and c++. I am confusing that which one to learn "c or c++" at first (I mean for beginner)? are those both same? Actually, it's really really my first time to learn code for Arduino. also, can you tell me where can I learn from? Thank you :)
You mentioned two key words, Beginner and Arduino.
Decision on learning C++ first versus learning C first might
be a matter of opinion for the key word Beginner since many
who start with one can easily adopt for the other.
learning C++ first however has some advantages versus learning C first
for the key word Arduino which I explain.
Arduino programing is mainly targeted toward bare-metal programming, which includes dealing with many environmental options/variables which are usually known at the compiling time.
Programming methodologies which exists in C++ that address processing known factors at compiling time outnumber those of which exist in C by a large number!
Although I must add that these features rarely appear in user programming interface, if any! But still these features would be available for one to implement individually regardless of using Arduino or other bare-metal programming toolkits.
Further more multiplicity of the environmental options/variables demands a well established hierarchical ordering and management which is also more addressed in C++.
You can always try the Arduino website itself as an easy source either for learning or for tutorials/examples!
But to learn the language correctly and completely always keep an eye on authentic sources like cppreference.com and/or cplusplus.com.
Finally you can always ask/lookup your questions and seek guidance here!
Good luck!

Good C++ alternative to MATLAB's "fminunc"? [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 6 years ago.
Improve this question
I am trying to convert some code written in MATLAB to C++. I'm having some (or actually quite a lot of) trouble finding an alternative to the "fminunc" function which is used in the MATLAB code that I can replace and use in the C++ code. I've been looking at the "dlib"-library because I've heard it could be a function there I can use, but I'm not sure what function to use.
This is how the "fminunc" is used in the MATLAB code I want to convert:
[theta, cost] = ...
fminunc(#(t)(costFunction(t, X, y)), initial_theta, options);
Does anyone know any good optimizing functions like this in C++?
I believe what you are looking for is Google's Ceres Solver, an open source C++ library for modeling and solving large, complicated optimization problems. The code is designed to handle two classes of problems:
Non-linear Least Squares problems with bounds constraints.
General unconstrained optimization problems.
Automatic Differentiation is also supported.
Several cool example applications can be found here.
There are a bunch of optimizers in dlib, some that use gradients and others than just work on black-box functions. You can see some examples here http://dlib.net/optimization_ex.cpp.html and more generally here http://dlib.net/optimization.html.

Polymorphic engines in C or 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 stumbled across polymorphic engines and I don't know anything about them. However, I am curious about how they are written. Every example that I've looked up writes them in assembly, my assembly is not good at all; I know just a few instructions here and there but not that well. On the other hand, I am good in C and C++.
I am familiar with the concept of polymorphism in C++ but after reading about polymorphic engines, I am assuming that they are different from the polymorphism in C++.
How can techniques such as using virtual keyword in C++ be used to obfuscate or encrypt the code in an application?
If a program has to be modified you can go either modifying the source code or modifying the compiled executable.
The first approach is awful (in my opinion) because:
A source file is subject to a lot of optimizations in the compilation processes. So two source files slightly different from each other could produce the same object code.
If you need your program to be self modifying you will have to carry with all the tools needed to build it. (Something like carrying a candy factory with you just for the case you want a candy of a different flavor in your trip)
...
Notice that I'm talking here about compiled languages as the use of C or C++ in your question suggests. For interpreted languages the first approach is the obvious one.
In your case, the second makes more sense but it is strictly related to the machine code of the target machine.
So my point is: if you want to implement a program or routine that is able to produce a modified version of other program or a modified version of itself you can implement it in Assembly, C, C++ or any other language but in all cases you have to be proficient in your target machine's assembly language and machine code.
I recommend you to research more. This topic is broad. In the case you decide to go on, I can say that Assembly won't be the biggest dragon to beat.

Best way to describe C++ program using charts [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 8 years ago.
Improve this question
I'm currently writing a developper documentation of a program I just wrote and which has to be continued by somebody else.
I'm documenting my code using Doxygen, but I'd like to show a more global view, using for instance flow charts filled with the name of the functions and the parameters they send to each other. But I also have to represent events, and it seems to me that flow charts are not the best for that, or a least I don't really see how to do it right and clear.
So Am I right? What would you need to catch on with a development of an already started application? Is there a better alternative than flow charts and UML?
From a general familiarisation perspective, I like seeing clear and detailed requirements specifications. This is lacking in the majority of cases in my experience.
From a design perspective, I like seeing state diagrams for state transitions, UML diagrams for general code structure and relationships and communication diagrams for information about data flows.
The more documentation you can give, the better it'll be for the next guy. But bear in mind that documentation can go out-of-date very quickly, so your (good) code comments and doxygen output are likely (but not necessarily so) to be more up-to-date than anything else you write.
As someone who picked up a 35,000 line Java project with 3 comments 2 of which were "this is gross" and "yeesh" I can say that I want to know what the abstract base classes are, what the flow of the program is, and any namespaces or global variables defined.
What's really helpful to me is a paragraph or two that says something along the lines of "main creates a driver of some base class which then reads in the xml file using some file reader and sets up an output object of type DefaultOutput before it executes the driver.run() function which ostreams the std:out to a file called output.txt and std::err to log.txt.
That paragraph would save me hours of picking through your code to figure out what gets used all the time.
It's also really helpful to have a "this depends on this so don't change it or you'll ruin literally everything" for any finicky code that might be present.