SKalinov
ohh i get it, so whenever we any kind of loop it makes the program iteration,right?
Yep, you are right. Iteration is when the same procedure is repeated multiple times.
/
hi someone can explain me what is extern for
\x90
Hi, any recommendations for books to learn write large code base in c, i mean the process of software development, write multiple parts and link them togeter, learn build system, debugging?
Thadeu
Hi, any recommendations for books to learn write large code base in c, i mean the process of software development, write multiple parts and link them togeter, learn build system, debugging?
well In Expert C Programming is explained the differences between static and dynamic linking. Also has many tips on debugging and traps to avoid. Beside of that, you only need to organize your code, what is very opinionated and depends on what you intend to do. Also a good tool to help you run tests, compile, install, and detections (compile for Linux, Unix, Win etc depending on architectures) is to learn Gnu Make.
/
But what is extern for
Thadeu
But what is extern for
http://stackoverflow.com/questions/2796796/ddg#2796804 A good resume
?
why C and C++ programming languages force every code be written in functions ? why the programmer isn't allowed to decide whether to write the code in function(s) or not just like in javaScript ?? what's the rationale behind C and C++ to force programmers to write code in manageable functions ?? i know its easy to read code and manage huge softwares this way but i dont think that this is the reason C and C++ force code be written inside functions. Madhu
artemetra 🇺🇦
if you are talking about top-level code, C/C++ requires an entry point, the main function, it needs to know where to start the execution
Rasel
how i compare two sets element by for loop?
?
if you are talking about top-level code, C/C++ requires an entry point, the main function, it needs to know where to start the execution
No im not talking about the main function or the entry point of a C/C++ program. i just want to know why we are forced to write every single piece of executable code inside functions in C and C++. why we aren't given the freedom to write code freely without functions like in javaScript
?
now im tired of hearing its just the way it is
artemetra 🇺🇦
No im not talking about the main function or the entry point of a C/C++ program. i just want to know why we are forced to write every single piece of executable code inside functions in C and C++. why we aren't given the freedom to write code freely without functions like in javaScript
- because C/C++ is compiled to machine code and linked to libraries, it yet again requires to have a main function - it's more managable and scalable - because headers are a thing and this might lead to unexpected code execution
?
main function is really required because of other functions we write in a C/C++ program it's really required to know which function to first call and "main" is this function
Aquatica
I can only imagine the boilerplate
_
Hello guys how to embed lua in C/C++ code, have tried on Fedora and it ain't working
Abiola Jeremiah O.
Hey
?
how do you write it without functions?
why we can't write code in C/C++ without writing our code inside functions ??
Abiola Jeremiah O.
• • • • * • • • ** • • *** • **** How can I use a nested for loop to write this code?
Abiola Jeremiah O.
I've been getting an infinite loop
Eniafe
Please I get this error reference to winman when I use codeblocks
Abiola Jeremiah O.
• • • • * • • • ** • • *** • ****
Abiola Jeremiah O.
Please how do I use a nested for loop for this shape??
Abiola Jeremiah O.
I've been getting an infinite loop
klimi
I've been getting an infinite loop
are you using for loops or while loops?
/
i have found this code typedef unsigned long long Out; volatile Out out,tmp; Out register rax asm("rax"); asm volatile("rdtsc":"=A"(rax)); out=out*tmp+rax; but what the double long means
/
i have also a problem
Thadeu
But what mean naming and calling conventions
as I understood, you can make your functions reusable by other languages, and to make it you need them be "callable" as C functions. So, if you write a C++ library and want to use the functions from this library, you need to make them compatible with the C calling convention (and naming). In this case you use the extern keyword.
/
for ( Preset &preset : presets ) { auto presetBag = presetsBags.at ( preset -> pBagIndex ); preset -> pGeneratorIndex = presetBag.generatorIndex; preset -> pModulatorIndex = presetBag.modulatorIndex; } why do this says that preset is not a pointer
Pavel
i have found this code typedef unsigned long long Out; volatile Out out,tmp; Out register rax asm("rax"); asm volatile("rdtsc":"=A"(rax)); out=out*tmp+rax; but what the double long means
long double is a floating point type, here's more info (it's about C++, but should be similar in C) https://en.cppreference.com/w/cpp/language/types
Pavel
Also this is one of downsides of using auto, you need to look in different places of code to make sense of it
Pavel
/
The variable
the variable presets is a vector
/
The variable
vector < Preset > presets;
Pavel
vector < Preset > presets;
Then preset is not a pointer, it is a reference, you should use . instead of ->
Thadeu
Hello guys how to embed lua in C/C++ code, have tried on Fedora and it ain't working
you need to have the headers installed. In Debian you need liblua5.X-dev where X is the Lua version. In any case it is better you report what kind of error occur and a better suited group is the own Lua language as your question is not C/C++ specific. https://t.me/LuaLang
Pavel
Preset * preset = &presets.at ( i );
Yes, because you take adress of it with &
Pavel
also in the loop
No, in the loop you use it to determine that your type is reference, these are two different meanings of &
/
in the loop
Pavel
so how i get the pointer
Why do you need the pointer even?
Pavel
Just use dot operator
/
Why do you need the pointer even?
because in that way i have not to repleace the object every time
Pooja
Ji
/
What do you mean by "replace"?
after modifying it i have to do presets.at ( i ) = preset
/
with the pointer no
Pavel
after modifying it i have to do presets.at ( i ) = preset
Are you sure? it should directly modify the value, since it's a reference
Pavel
If you didn't put & on your type, then it would be a copy and that would be needed
/
why it doesnt give a pointer
Pavel
why it doesnt give a pointer
Because you don't need a pointer there
Pavel
I mean there's nothing that would make pointer be more valuable in this case
/
Because you don't need a pointer there
i try without the & and i see if it modify the value without replacing
Pavel
also if i dont use it it doesnt work
"doesn't work is very vague", can you show the code that "doesn't work" and tell what it should do?
Pavel
i try without the & and i see if it modify the value without replacing
You mean Preset instead of Preset&? You should use Preset& in the loop
Pavel
Why
Otherwise you will get a copy, and you said you need to modify the original record
Pavel
You said if i use & it give me a copy
I said the opposite, i probably wasn't clear enough