Ludovic 'Archivist'
zahra
FriedRice
FriedRice
You can learn STL and the algorithm at the same time so you get to know “why STL”.
\Device\NUL
Rose
User Kishan has 1/2 warnings; be careful!
Reason:
ad
Rose
Purge complete.
Ludovic 'Archivist'
Does the group look like a ChatGPT prompt ?
Rose
User Devil has 1/2 warnings; be careful!
Reason:
do your own homework
Ludovic 'Archivist'
I think I warned you already less than 2 minutes ago
Ludovic 'Archivist'
Do you want to be banned?
Devil
Ludovic 'Archivist'
No sorry
Then take warnings into consideration, we will not do your homework
Rose
That's 2/2 warnings; Kishan is banned!
Reasons:
1: ad
2: ad
AlanCcE
Hi everyone, I'd have a question about macros and debugging.
During some projects that I had done in C, I always had thought about how much cool would be to have some "Debug" macro in which I could put some extra code to be compiled in case of some DEBUG flag being defined at the code, I know that it could be done with some simple IFDEF's, but this always looked a little bit too messy to me.
Today I took some time to try to create a macro that could satisfy this problem and I got something like this:
#define _Debug(code) \
do { \
code \
} while(0)
#else
#define _Debug(code)
#endif
A very simple test case can be found here:
https://gist.github.com/Anthhon/12e1b0c4923fb330838168f356e554ea
I think it works well for what I want, but I'm not sure if there's anything I can do to make it better or if it could have some weird behavior that I'm not seeing. Could someone with more experience with the compiler help me out?
Rose
Purge complete.
Ahmad
Hello everyone,
Please I need someone that will guide me more explanation about c programming for beginners,
But my question now is
Is there any keyword in a c programming that will takes
Alpha numeric to declare the variables?
Kenshin
Suka
Simple Sorcerer
Hi all. how can i get a pointer to a class function so that i can call it anywhere in the code. i need "C" compatibility.
I think the example will make it clear:
c++
#include <cstdio>
#include <cstdlib>
//==========================================
//============== C function ================
/*
* the function is somewhere very deep
* in the code (not in main)
*/
int fun(auto *fun_ptr){
// ...
(*fun_ptr)(/* variables */); // call function => class function
// ...
}
//==========================================
//============== C++ class =================
class A{
// ...
void fun(/* variables */);
// ...
};
//==========================================
//======= somewhere not in the main ========
int main(int argc, char *argv[])
{
// ...
A a;
auto fun_ptr = &(a.fun);
// ...
fun(fun_ptr);
// ...
}
Simple Sorcerer
I need to use a class function as a callback function
Simple Sorcerer
auto => void (*fun_ptr)(....)
Simple Sorcerer
or I need a clue on how to get around it.
Anonymous
If fun() is a member function, there have to be a way to pass an instance of class A. You could write a wrapper function that use a local static variable of A or make it a template like template<A&> .
Rose
Purge complete.
Younes
Hi guys
Has anyone solved linear programming(LP) problems?(section 29 in CLRS 4th edition) I'm stuck, Can anyone guide me?
Simple Sorcerer
Younes
Tell us what you can't do, we'll help you.
Sure,
here my github repo: https://github.com/younesious/Simplex/blob/master/simplex.cpp in this file I wrote a program to solve LP problem with simplex method and print table for every iteration and everything is cool and nice. so far so good. but now when we have ">=" or "=" in constraint and we can't find any BV for constraint problem have been started...
Rob
Can someone share with me a pdf which I can use to learn both C and C++
Simple Sorcerer
Kenshin
Can someone share with me a pdf which I can use to learn both C and C++
The links above having been provided, your intent seems to be to learn both, concurrently. Maybe don't. Start with one, get on your feet running, well enough to contribute to an open source project, then begin learning the other.
As much as people relate the two to the point of referring to them as C/C++ sometimes, they both have preferable idioms and idiosyncrasies that will only be a heavier cognitive load than is necessary while learning. Same is true of learning any two or more programming languages in parallel.
Simple Sorcerer
Simple Sorcerer
I think we need to start with the C language
I also want to note that in the C language, although it is not convenient everywhere, the code itself asks to be optimized. In C++ you can write the same thing using stl, but you can not significantly screw up the performance
Simple Sorcerer
said of course a very controversial point. but still agree that C code will still be more optimized
Pavel
Oh damn, I've spent more than half an hour figuring out why my getter returns 1 when the value is 2, rebuilding, running memcheck and UBsan, only to discover that I've accidentally made the return value bool.
I love C++
Ahmad
Ariana
Hello guys. When I try to run my c++ code on vs code I get this error. I don't know why its happening it was just fixed I probably clicked something accidently.
"This version of .exe is not compatible with the version of Windows you're running."
Ariana
Ariana
Pavel
How can I check it?
First of all, I would check your compiler flags (not sure how to do that in vs code), and see if there's something that forces x86/x64/arm
Pavel
Ariana
x64 based processor. I checked in the system properties
Ariana
Pavel
my_file.h
Yes, but how are you running it?
I guess you mean that you press a button to compile/run while this file is opened, but the interesting part is what sent to the compiler
Ariana
Ariana
Pavel
BDev
Pavel
ctrl + alt + N
Sure (I never worked in VS code, so I have no idea what it does)
Ariana
Pavel
Technically .h and .cpp are just for the user to separate them logically, you can compile a header or include a cpp file and it will work (don't do that though more than for laughs, bad habits die hard).
BDev
harmony5 🇺🇳 ⌤
harmony5 🇺🇳 ⌤
ctrl + alt + N
Check if there is a .vscode folder in your project. There should be a file with a config for the run feature of vscode
Ariana
Ariana
also i got new error "c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../libmingw32.a(main.o):(.text.startup+0xa0): undefined reference to `WinMain@16'
collect2.exe: error: ld returned 1 exit status"
\Device\NUL
Zain
Anyone knows any good site or YouTube channel to learn C++
Ya deway
Hi guys, I would like to learn the kernel of the Windows 10 operating system in an advanced way, in particular the management of drivers, processes, threads and kernel modules or in any case everything that goes around it. Do you know of any good ebooks/resources?
\Device\NUL
Ya deway
By Microsoft?
\Device\NUL
\Device\NUL
Windows Kernel Programming 2nd edition is also good
Ya deway
Seems Cool thanks!
Maxi
Hey guys
Maxi
So am currently new in programming but i want to learn skills and how to be a master can anyone help me?
Amale
Is there someone use vs code for c programming??
Takashi
Ahmed
Hello everyone,
I made a simple project with C in vscode.. but i couldn't do the "Makefile" can someone help me with it?
pasta
Can someone look at this please and tell me why this works and doesn't throw the too few arguments exception? It throws the exception if the function is in the same file.
https://onlinegdb.com/FpvzR8rcg7