Ludovic 'Archivist'
locking a mutex is pretty cheap, unexpectedly failing to lock one is what is expensive, I need to preserve message ordering mut if you do not, you can use 2 queues and 2 mutexes. if you fail to lock one, lock the other and vice versa
The
make use of ioservices and threads to run your client processes, they are made for that in asio
Ok .. let me run a few experiments with locked queue, and that consume one.. and asio strand model too.. I'll get back with results.. Anyway to deterministically test and error out race conditions , and memory ordering bugs?
The
Coz memory ordering bugs will show up in prod 6months down the line maybe
Ludovic 'Archivist'
Ok .. let me run a few experiments with locked queue, and that consume one.. and asio strand model too.. I'll get back with results.. Anyway to deterministically test and error out race conditions , and memory ordering bugs?
testing for race conditions is hard, I just run tests with every run that could result in a race condition and try to break things, and run tests systematically and automatically several times every day
Ludovic 'Archivist'
Ludovic 'Archivist'
dumb and robust
Ludovic 'Archivist'
and test extensively
Ludovic 'Archivist'
no tests should every fail. if a test fails, something is wrong and should be fixed (leaving "correctly failing" tests in the pipeline creates noise that will let race condition bugs slip away)
Pippi
Also, 31 hours is a very short overview, when I teach students that have worked with C# for 2 years already, and have 120 hours of course to give, I still see them as monkeys equipped with typewriters
I don't think you can completely learn anything in a specific time frame. You can learn the basics of c++ from a 4hrs freecodecamp tutorial. Then you practice like hell. It's only through practice you become a master. The more I delve into C++ the more I realise I know nothing.
Pippi
and then you make mistakes for 3 to 5 years and then you are an OK C++ programmer
120 hours won't stop u from making mistakes. You learn through mistakes. You also pick a specific niche.You can't do it all
Ludovic 'Archivist'
(with a 35h week and the french government mandated paid leave removed)
The
I'm a noob after 10 years.. should've focused on it completely..
Ighor
hi, do anyone know alternative to crashpad/breakpad that works with mingw64 builds?
Adeyemo
And intermediate c++ programmer here that need a learning partner? I need an accountability partner. Or probably a mentor. I currently spend 35 hours per week on my personal development. Please the bosses in the house should kindly help we that are just coming up. Thank you ❤️
Adeyemo
I need.. same need accountability too.. we can do it here itself for things stuck in.. or OT.. idk if i intermediate tho..
Good, do it here? I think we can discuss privately then when we have issues we bring it up here for the Dons to guide us. That's a bit mild.
Adeyemo
I meant we can go by project, we have a common GitHub repo and we build together, help each other along the way and when we have blocker we come here. What do you think?
Adeyemo
Or you just us to come up here every day and declare I did this today or sort. Lol, that's won't help much I think
Adeyemo
My opinion anyway, let me hear how you feel about that
Adeyemo
Offtopic?
John
any one with Dev C++ app
John
lol okay, thanks 😅
klimi
John
can someone assist me with the setup for Dev C++ for Windows, please.. Thank you in advance
John
https://t.me/cpp20programming/190
thank you so much 🙏🏽
Manav
Don't bother with ancient stuff, it's nearly 2024. If the ui looks like windows 95 it's a good indicator to avoid the software, unless you have time machine to go back to 1990s.
Anonymous
how to setup c/c++ in vs code?
Danya🔥
how to setup c/c++ in vs code?
Have you tried asking it in Google and looking on the official site?
Anonymous
yes i tried i installed MinGw
Anonymous
followed every step
Anonymous
still cant run the code
Ілля
Hello everyone. What is better to use to assign an iterator, a method or a function? What is the difference? I would be grateful for your answers. Example: #include <iostream> #include <vector> using namespace std; int main() { vector<int> vec = { 0,1,2,3,4,5 }; vector<int>::iterator iter_vec = begin(vec); //or vec.begin(); cout << *iter_vec; return 0; }
Yash
Can someone help me to learn C language
Yash
I am beginner and know some basics of C language
Anonymous
Can someone explain me what would happen if in this program instead of using the deference operator we use pB++ = pA++; char strA[80] = "A string to be used for demonstration purposes"; char strB[80]; char *pA; char *pB; pA = StrA; pB = StrB; while(*pA != '\0') { *pB++ = *pA++; }
Wassim
Can someone explain me what would happen if in this program instead of using the deference operator we use pB++ = pA++; char strA[80] = "A string to be used for demonstration purposes"; char strB[80]; char *pA; char *pB; pA = StrA; pB = StrB; while(*pA != '\0') { *pB++ = *pA++; }
Then you will not copy strA to strB but you will put the addresses of strA's characters in pB, so strB won't be a clear sentence since you didn't put anything in it because pB has changed
C
https://pastecode.io/s/8nuct112 can anyone tell me what's causing runtime error? i am trying to merge overlapping intervals
C
https://pastecode.io/s/8nuct112 can anyone tell me what's causing runtime error? i am trying to merge overlapping intervals
I am deleting from the vector while iterating over it, does it messes up the iterators and causes seg fault?
The
I am deleting from the vector while iterating over it, does it messes up the iterators and causes seg fault?
Yes it will invalidate the iterators.. sorry didn't see code.. not sure . Check if r goes beyond the vector size after loop
Ludovic 'Archivist'
Hello everyone. What is better to use to assign an iterator, a method or a function? What is the difference? I would be grateful for your answers. Example: #include <iostream> #include <vector> using namespace std; int main() { vector<int> vec = { 0,1,2,3,4,5 }; vector<int>::iterator iter_vec = begin(vec); //or vec.begin(); cout << *iter_vec; return 0; }
So... it is complicated.I generally like to use vector::front() and vector::back(), or their span counterpart. if I am making an algorithm, I want to use iterators, but if I am consuming a vector specifically and manipulating increasingly decreasing bit of it, I prefer to use a bunch std::span instead of iterators or methods. The main point is that you need to check vector::empty() before using vector::front() and vector::back(), and need to compare iterators to do any calculations, likewise for the spans you will need to handle span::empty(), and I generally trust span::empty() and vector::empty() more to not cause people writing errors than comparisons
Ludovic 'Archivist'
Then technically std::begin() is supposed to be always the superior method, as it works correctly with more types like array types... but I generally have to admit to being lazy and not using it and resorting to vector::begin()
ᴍᴏʜᴀᴍᴇᴅ
I can access and edit chrome or any browser local storage with c/cpp?
ᴍᴏʜᴀᴍᴇᴅ
with c/cpp you can access any file
I cant access it via chrome api like javascript LocalStorage.getItem(.....
ᴍᴏʜᴀᴍᴇᴅ
maybe you are lacking permissions?
I have no idea about the topic
Ludovic 'Archivist'
I cant access it via chrome api like javascript LocalStorage.getItem(.....
What kind of environment are you in? is it a WebAssembly carried with emscripten?
Light
Umm hello, can some body explain to me why in some of my class functions when i dont use const arguement it starts misbehaving like a spoiled brat.
Light
error: cannot bind non-const lvalue reference of type 'ComplexCalculator<double, double>&' to an rvalue of type 'ComplexCalculator<double, double>'
Light
Please note i was creating complex calculator
FriedRice
Your function takes && right? Not &.
Light
My function takes &object
Light
When i created operator/ for division it took (ComplexCalculator &other)
Light
And then the rest was just formula
Light
I just wanna know what chatgpt mean when it said const is used to precent misbehavior
Ziky
Const just prevents you from altering data which shold not be altered, like data of object shared by multiple functions, constants, or "source" argument of functions like memcopy...
FriedRice
That's unfortunately impossible, your compiler says you were trying to bind a lvalue reference to a rvalue reference. This only happens when the function takes a && and you give it &. Can you make sure operator / is overloaded with the correct parameter types?
Anonymous
That's unfortunately impossible, your compiler says you were trying to bind a lvalue reference to a rvalue reference. This only happens when the function takes a && and you give it &. Can you make sure operator / is overloaded with the correct parameter types?
No. It says he is trying to bind a lvalue reference to an rvalue object and not reference. void fun(int&); fun(5); //this is an error as a non const lvalue reference can't bind to a prvalue So if he has a function like: void fun(ComplexCalculator&); and he calls it like fun(ComplexCalculator{}) he would get the error above
FriedRice
You are right 👍
𝔖𝔞𝔯𝔬
Guys is there anything like a wrapper library to use os api’s in the same way to write functional code working on both Linux and windows ?
𝔖𝔞𝔯𝔬
I was thinking if there was something for general usage, tho I know there are some wrapping library for more specific task like sockets management
Paulo
It's not a function signature
Why not? It's has no body? Only declare it's name and parameters types?
Danya🔥
Why not? It's has no body? Only declare it's name and parameters types?
It's a non-correct function call The correct one would be fun(Complex{})