Anonymous
How about c++ series from "the cherno" YT channel, I planned to follow this tutorial, what your opinion about this ? 😖😖😖
Well, this is actually not a bad one, but I'm not sure that it is suitable for completely beginners
Anonymous
I saw the update, but what is exactly your problem?
https://gist.github.com/Total-Control-9985/c9e09b8bafbe8220ccb295fcd546262d
Ammar
https://gist.github.com/Total-Control-9985/c9e09b8bafbe8220ccb295fcd546262d
I don't understand, that log doesn't tell me anything about your goal.
Anonymous
why do i sometimes get START MAIN EXECUTOR EXECUTION THREAD IS RUNNING FINISH MAIN EXECUTOR JOINING waiting for EXIT pid 1075525 JOINED and sometimes get START MAIN EXECUTOR EXECUTION THREAD IS RUNNING FINISH MAIN EXECUTOR JOINING waiting for EXIT pid 1075526 wait_for_state (pid 1075523): expected state: EXITED, got state: CONTINUE
Anonymous
or rather, why does the CONTINUE state get caught only sometimes, and not every time?
Anonymous
as both init tests call terminate() explicitly and in the destructor void ExecutionManager::terminate() { if (running.load()) { running = false; for (ThreadCreationInfo * t : threads) { Thread * t_ = &t->thread; if (t_ != this_thread) { if (t_->suspend) continueThread(t_); joinThread(t_); delete t; } } joinThread(this_thread); this_thread = nullptr; threads.clear(); } }
opencore
#ide
opencore
#awesomeness
Sardi
Does anyone know what is the difference between IF / ELSE and SWITCH? When is it best to use each one?
Anonymous
ok i think i got my thread manager stable :)
Anonymous
Does anyone know what is the difference between IF / ELSE and SWITCH? When is it best to use each one?
switch uses a compile-time jump table which is faster than a runtime if else statement which uses conditional branching
Anonymous
if constexpr (C++17) however is computed at compile time instead of runtime
Sardi
yes
But at compile or run time?
Anonymous
https://en.cppreference.com/w/cpp/language/switch
Sardi
Thankss
Anonymous
https://www.eventhelix.com/embedded/c-to-assembly-translation/ this may help
Anonymous
Case values in narrow range If the case values are placed in a narrow range, the compiler can avoid performing a comparison for every case leg in the switch statement. In such cases, the compiler generates a jump table which contains addresses of the actions to be taken on different legs. The value on which the switch is being performed is manipulated to convert it into an index into the jump table. In this implementation, the time taken in the switch statement is much less than the time taken in an equivalent if-else-if statement cascade. Also, the time taken in the switch statement is independent of the number of case legs in the switch statement. Case values in wide range If the case legs of the switch statement have a wide deviation in values, the compiler cannot make a jump table to handle the switch statement. In such cases, the jump table would be huge in size and filled very sparingly. Thus the compiler resorts to using a cascade of comparisons to implement the switch. The code generated for the switch statement in such cases will look more like a series of if-else-if statements. Here the time taken to execute the switch statement increases with the number of case legs in the switch. Big switch statement with wide distribution If the switch statement has a very large number of case legs and the values are widely distributed, some compilers use binary search to select the case leg. The different case values are sorted by the compiler at compile time for a binary search.
Anonymous
What do you do before the part that says JOINING? I can't find the corresponding code on the gist you sent.
before that is simply // start ExecutionManager::waitForStop(this_thread); ExecutionManager::continueThread(this_thread); // join ExecutionManager::joinThread(this_thread);
Anonymous
What do you do before the part that says JOINING? I can't find the corresponding code on the gist you sent.
how threads are created https://gist.github.com/Total-Control-9985/62bfe8a66688d1e8e227e4ce66faa00d
Hamza
Who we convert letter into ASCII code
Anonymous
Who we convert letter into ASCII code
char letter = 'A'; int ASCII_CODE_A = (int) letter;
Anonymous
https://stackoverflow.com/questions/37241364/difference-between-char-and-int-when-declaring-character/37241654
Anonymous
ok, i can now correctly create and join suspended threads :)
Anonymous
wow, only 415 lines...
Anonymous
my old execution manager is 922 lines and is a mess
Ибраги́м
Using Enum, available in g++-11 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1099r5.html
Ammar
how threads are created https://gist.github.com/Total-Control-9985/62bfe8a66688d1e8e227e4ce66faa00d
Still confusing to me. Really, I can't grasp the exact problem from your story and piece of code. I would need a minimal working example to compile it myself to see exactly the real problem in front of me in order to find the point you're talking about. But anyway, you've managed to solve it. So I don't really want to ask further detail.
Ammar
Who we convert letter into ASCII code
Practically, in C, any char is 8-bit integer that contains ASCII code. It is just how you print it. The print format is %hhd for signed 8 bit and %hhu for unsigned 8 bit. No need to cast anything, unless you use insane library like iostream which implicitly prints 8 bit type as character.
Hariyana Grande
The program: Given two angles of a triangle, calculate the third angle. INPUT: A single line containing the two angles a et b separated by a space. OUTPUT: A single line containing the last angle c. CONSTRAINTS: 1≤a<180 1≤b<180 EXAMPLE: Input 1 1 Output 178
Hariyana Grande
how do i solve these kind of problems
Hariyana Grande
i searched on youtube but they directly solved it without giving proper explaination
Anonymous
homework huh ?
Prince Of Persia
Prince Of Persia
🤨
Prince Of Persia
I know I know And you need to someone do your exercise for you😂
Prince Of Persia
1. Open a browser or click on google.com 2. Click on text box 3. Write anything you need
Prince Of Persia
😂👍😅
Prince Of Persia
Go and enjoy
Prince Of Persia
Do you know what is my name?
Prince Of Persia
My name is Abo Izrael Do you know who is Izrael?
Anonymous
Prince Of Persia
Anonymous
Hey why do companies like Amazon etc use c++ for selecting students? Instead no c++ is used for their own development they use java
Prince Of Persia
Amazon uses C++ in the back-end
Prince Of Persia
https://www.quora.com/Why-do-tech-giants-like-Google-Amazon-and-Facebook-use-C++-for-their-back-end-What-are-the-advantages-of-using-C++-against-other-languages
Anonymous
Amazon uses C++ in the back-end
So what is the work of a c++ dev in Amazon?
Prince Of Persia
So what is the work of a c++ dev in Amazon?
Let's imagine they don't use C++ but they select student who knows C++
Prince Of Persia
Because C++ is one of the hardest language for learning
Anonymous
Ohk
Prince Of Persia
And if someone knows C++ He/She can do anything
stranger
https://www.quora.com/Why-do-tech-giants-like-Google-Amazon-and-Facebook-use-C++-for-their-back-end-What-are-the-advantages-of-using-C++-against-other-languages
Isn't it true that no app is built on single language. It's understandable some parts are written in python. But it doesn't mean they don't use cpp at all. I mean is there any way to actually verify?
stranger
And if someone knows C++ He/She can do anything
So people waste 4 year of college to prove that they can do anything 😂
Prince Of Persia
I said They use C++ But no completely
stranger
I said They use C++ But no completely
Oh ok. Sorry. I was just annoyed by answer as it make python seems very much preferably over any other language.
Kr. Sunny
It's not about knowing one kango or not... It's about experience guys.
Kr. Sunny
Every lango has it's own beauty.
Prince Of Persia
I said They use C++ But no completely
If you read the page You will find It's not only they use c++, it depends .most of the software driven technology products are written in python ex Dropbox, one of the best thing created has 20million code in python.
Prince Of Persia
So people waste 4 year of college to prove that they can do anything 😂
Trust me I just learned C++ But I can do anything by C++ even creating Android apps😂
Anonymous
😀
Prince Of Persia
Jasur Fozilov 🐳
Creating android app? How do you do that with cpp?
Android studio supports c++ with NDK
stranger
Android studio supports c++ with NDK
Yeah, but isn't it a tedious process just to use favourite language. I would have really considered learning java over that 😅
OnePunchMan
Hello I know c++ language but dont know how to write applications. Can any one give resources for same. Example application :: https://github.com/psx95/collaborative-text-editor
Anonymous
Hello everyone, I've a problem with passing a parameter to constructor inside a for loop, can anyone help? C++
Anonymous
let say I've class Student { public: Student(string Name = "XXXX", double English = 100) { this->Name = Name; this->English = English; } private: string Name; double English; };
Anonymous
So when I'm trying to create the list of 5 people by using a for loop, it's showing me an error: for (int i = 0; i <= 5; i++) { cin >> Name; cin >> English; Student s[i](Name, English); }