Igor🇺🇦
I have tried and successfully ran example given at GitHub. But when I am using with my own code then getting segmentation fault error.
This is too broad questions. It's better to read documentation https://developers.google.com/protocol-buffers/docs/proto3. Without code and knowing your configuration it's just a random guess what went wrong.
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
using namespace std; is bad
Anonymous
Oh it's a matter of choice? I mean it's just a standard convention?
Dima
Oh it's a matter of choice? I mean it's just a standard convention?
imagine having some other library with the same methods
Dima
calling just ::min will be ambigious
Igor🇺🇦
Oh it's a matter of choice? I mean it's just a standard convention?
As long as you're not writing using std in header it's fine.
Anonymous
calling just ::min will be ambigious
That i know it's ambiguous what i am saying is something different
Dima
Anonymous
Nope i had seen some senior developers explicitly typing std each time that's what make me think so.
Dima
typing std:: instead of using namespace is much better
Dima
but it has nothing with performance
Anonymous
thats the right way
That's what i asked it is a standard convention.
Vitaliy ◀️TriΔng3l▶️
That's what i asked it is a standard convention.
It's how you prevent collisions in naming
Dima
well your question must be confusing then:)
Anonymous
well your question must be confusing then:)
Yes now i get it why they explicitly type each time.
Igor🇺🇦
but it has nothing with performance
It can affect in theory compilation time. Compiler has to do more resolutions
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?
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
Why are you using same names for all variables?
it is a for loop, does it really matter?
Fabio
topic_names, i ?
i is just a counter
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
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
wait, let me test
Fabio
wtf, that's my code ahahah...why the output is not the same
Igor🇺🇦
wtf, that's my code ahahah...why the output is not the same
Probably the issue is somewhere else in definitions of classes, printing method or something like that
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?
Anonymous
Okay.
Anonymous
And can you tell me what is QT and GTK+ ?
Till
And can you tell me what is QT and GTK+ ?
Qt is widget toolkit for creating graphical user interfaces gtk too
Anonymous
And ImGui is also similar?
Anonymous
Is ImGui Cross platform library?
Igor🇺🇦
I want to learn gui development using c++ where should i began?
I think Qt has great documentation and is very popular. So my suggestion is Qt. Of course this is only an opinion. There is no one size fits all answer.
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
And ImGui is also similar?
It’s immediate rendering
Anonymous
https://twitter.com/pati_gallardo/status/1222931733483589636?s=19 😅😅
Artöm
And can you tell me what is QT and GTK+ ?
gtk is C though and linux only
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
I prefer a pastebin/compiler explorer link
https://pastebin.com/axmnrxCJ
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.
Anonymous
Currently i am using Ubuntu 18.04 LTS but due to Nouveau graphics card it's unstable for my machine.
I am using third party graphics software and sometimes it is very irritating.
Anonymous
Too complicated
So how to make it easy or readable? Any tips?
Anonymous
So how to make it easy or readable? Any tips?
Atleast write some proper comments so that the reader knows what you are writing.
Anonymous
Okie👍
Anonymous
Okie👍
Try to write line by line comments explaining each line.
Anonymous
Ohkie
Dima
The algorithm can be simplified very much