Dima
so learn everything yourself
Anonymous
Anonymous
Anonymous
Docs learnt us all
Dima
I mean about colleges and another stuff
Dima
docs for the win
Anonymous
Docs is the master teacher
Anonymous
Anonymous
Dima
Anonymous
Dima
ok.. anyone prefers that
void Get(Object& out)
over that
Object Get()
Dima
?
Anonymous
Dima
I think or the first one is efficient (I am not talking about rvo and stuff)
Anonymous
sorry this sticker send by her self
Anonymous
i am new in this app
Anonymous
hhhh
Anonymous
i am sorry
Anonymous
Anonymous
i try to change it hhhh
Anonymous
Dima
I know modern compilers support RVO but am just curious
Dima
returns local temporary variable
Dima
Object Get() { return Object(); } vs
Object obj; Get(obj);
void Get(Object& out) { /* work with out there */ }
olli
So in the second case you would be required to write
Object o;
Get(o);
?
Dima
yes, am curious whats more efficient to use
Dima
or its basically the same if RVO is supported
olli
If the compiler performs RVO the performance might be the same
olli
However, is it not possible to perform the get functionality inside your constructor? (In case you are only creating the temporary object to perform the get Operation)
So would only need to write
Object o;
Dima
I have something with string manipulations
like String cpuName;
and calling some platform-depend stuff like cpuName = Platform::GetCpuName.. and so on
Dima
its example
Anonymous
which you tuber channel is best for learning c ?? plz tell me frnds
Anonymous
How to solve this problem
Dima
Easy
Dima
Jussi
Maaf
Happy Independence Day, 4th of July for US People.
hyp3rbor3ax
How to solve this problem
even/odd with modulo-operator %. the other things with compare-operators <=/>=. Combine them with &&. print with printf
Anonymous
many
That means receive and send at the same time
Jussi
Bi-directional?
Jussi
Use 2 sockets
Jussi
And 2 threads
Jussi
It will be async tho
Manuele
Jussi
Nvm
Jussi
Use 1 socket and 2 threads
Dima
Dima
Manuele
Even with rvo enabled?
it always depends with what type of data are you working. if you works with big structures, reference is faster, otherwise value
Dima
hmmm yeah I do work with large objects
Jussi
Jussi
Without ref you always make a copy in cpp
Manuele
i need high parallelism performances with big tensors. with value, i lost more time by coping data than do the calculations
many
Dima
Return Value Optimization
Jussi
mm
Dima
Most compilers support that
Jussi
is it built in to some compilers?
Jussi
oh
Jussi
didnt know that
Igor🇺🇦
The best way is just to use compiler Explorer an see for yourself
Dheeraj
Done
Anonymous
🤙🤙🤙
Thanks
Jussi
Return the value normally
Jussi
Let's say you have Object mObject in class
Jussi
Object& Get()
{
return mObject;
}
This will return a reference to the member object mObject
olli
okay, I see
But then it differs from void Get(Object &) since the class would be the owner of the object
Jussi
How come?
Jussi
The 2 ways are identical