Manish
@JRandomGuy thanks
Anonymous
Is there any performance issue in using “using” directive as “using namespace std” and just explicitly typing std each time?
Dima
Dima
using namespace std; is bad
Anonymous
Oh it's a matter of choice? I mean it's just a standard convention?
Dima
Dima
calling just ::min will be ambigious
Igor🇺🇦
Dima
Dima
Anonymous
Nope i had seen some senior developers explicitly typing std each time that's what make me think so.
Dima
Dima
typing std:: instead of using namespace is much better
Dima
but it has nothing with performance
Anonymous
Vitaliy ◀️TriΔng3l▶️
Dima
well your question must be confusing then:)
Fabio
I've this vector std::vector<ros::Publisher*> pub; and I want to push different object with different topic_name pub.push_back(new ros::Publisher(topic_name.c_str(), str_msgs[i]));
Now, I've solved the problem with the topic name, but the push_back push the third object three times
Fabio
imu_0 //First iteration
imu_1 //Second iteration
imu_1 //Second iteration
imu_2 //Third iteration
imu_2 //Third iteration
imu_2 //Third iteration
Why?
Igor🇺🇦
Fabio
for(int i = 0; i < MAX_SIZE; i++){
std::string topic_name = topic_root + std::to_string(i);
pub.push_back(new ros::Publisher(topic_name.c_str(), str_msgs[i]));
for(uint8_t i=0; i < pub.size(); i++)
Serial.println(pub[i]->topic_);
}
Fabio
this is the loop, the second one is for debug
Igor🇺🇦
Why are you using same names for all variables?
Igor🇺🇦
topic_names, i ?
Fabio
Fabio
do u think I should put the declaration of topic_name out?
Igor🇺🇦
I'm on a phone and can't see properly your code, but there is no reason to reuse variable names in the same loop. Does it cost you anything? 😉
Fabio
Nope ahahah
Fabio
Let me test
Fabio
nope, nothing has changed, https://hastebin.com/mirafaroqo.cpp
Fabio
Igor🇺🇦
it will be strange, but the output is this
This code looks similar to what you're trying to do here https://onlinegdb.com/Hy2dE2lfI ( from my understanding of missing parts) and the results is as expected:
Igor🇺🇦
Were my additions to missing parts of a code wrong and that's not what you're trying to do ?
Fabio
Fabio
wait, let me test
Fabio
wtf, that's my code ahahah...why the output is not the same
Fabio
Maybe the publisher object assign the same address, but i can't understand why
Anonymous
I want to learn gui development using c++ where should i began?
Anonymous
Which library should i prefer?
Dima
Anonymous
Okay.
Anonymous
And can you tell me what is QT and GTK+ ?
Anonymous
And ImGui is also similar?
Anonymous
Is ImGui Cross platform library?
Anonymous
Igor🇺🇦
Yes i searched on google for a while QT seems to be popular.
It has great documentation as well.
And is more popular on stackoverflow so it's easier to get answers. ( not very scientific apporach ;)
https://stackoverflow.com/questions/tagged/qt
https://stackoverflow.com/questions/tagged/imgui
https://stackoverflow.com/questions/tagged/gtk
Dima
crt
Anonymous
https://twitter.com/pati_gallardo/status/1222931733483589636?s=19
😅😅
Artöm
Artöm
Anonymous
Hey everyone
Anonymous
Anonymous
Can anyone review my code?
Anonymous
It is a calculator based on stack
Fnony
Thanks
Francisco
I prefer a pastebin/compiler explorer link
Anonymous
Anonymous
Anonymous
Instructions to use:
Use symbols given below
bracket : "("
Plus: "+"
Subtract: "-"
Divide: "/"
Multiply: "*"
Power: "^"
Anonymous
Which is the most preferable Linux distribution for Programmer's?
Anonymous
Currently i am using Ubuntu 18.04 LTS but due to Nouveau graphics card it's unstable for my machine.
Dima
Anonymous
Anonymous
Okie👍
Anonymous
Anonymous
Okie👍
Try to write line by line comments explaining each line.
Anonymous
Ohkie
Dima
The algorithm can be simplified very much