Harsh
Read bjarne's book
can you tellme any tutorial sites
MᏫᎻᎯᎷᎷᎬᎠ
can you tellme any tutorial sites
I know only books and prefer them read this one: Programming Principles and Practice Using C++
MᏫᎻᎯᎷᎷᎬᎠ
2nd edition
MᏫᎻᎯᎷᎷᎬᎠ
It's from the inventor of the language
Ludovic 'Archivist'
can you tellme any tutorial sites
Most tutorials for C++ have been written by congenital idiots with a screw loose
Ludovic 'Archivist'
Most tutorials for C++ have been written by congenital idiots with a screw loose
Which is why, only take tutorials written by non-moron individuals with a screw loose
Ludovic 'Archivist'
You require to have quite a few mental issues to write C++
Dima
Would early return/guard prevent rvo? I am curious about this one
Dima
Yes
Anonymous
I didn’t get you
Ludovic 'Archivist'
Would early return/guard prevent rvo? I am curious about this one
I don't know but inconsistent discards of return value can
Ludovic 'Archivist'
Which is why [[no_discard]] is your friend
Ludovic 'Archivist'
I meant local static variables !!
Read my answer on that topic
Ludovic 'Archivist'
Specifically thread local ones, static ones, and those initialized by _start
Anonymous
where to read?
Anonymous
?
Ludovic 'Archivist'
Ajay here
I could add to that that it means they are not freed at the end of the function
Nick
😅😅 Of course not. It shouldn't be allowed. But a clean, croped screenshots should allowed i think.
Anonymous
If we create a copy constructor in a class, does the compiler creates a default constructor for the class?
Anonymous
I read this: When not to use return by address: 1. When returning variables that were declared inside the function or parameters that were passed by value (use return by value) 2. When returning a large struct or class that was passed by reference (use return by reference) Kindly explain the reason for the second point.
Anonymous
so you don't have to use the address-of (&) operator on the reference you were passed.
Anonymous
It's much safer to just return the reference you were passed.
Dima
and it will not be copied
Anonymous
I don't think there are many reasons at all to return by address in C++.
Dima
there are
Dima
fuck pure functions and functional stuff
Dima
Anonymous
well, one that comes to my mind would be low-level memory management
Anonymous
^lol
Dima
I think it’s okay to return by address if there can be none lol
Dima
returning by a reference fields that are not on a heap
Pavel
What "return by address" means? Return by raw pointer?
Dima
I think so
Dima
I didn’t get it too
Anonymous
yeah, I think so too.
Anonymous
Since a pointer really is just an address
Anonymous
(A C-Pointer that is)
Anonymous
iirc unique_ptr is just an address too.
Anonymous
Not sure now.
Anonymous
*stored as just an address
Anonymous
What "return by address" means? Return by raw pointer?
Return by a raw pointer via function's parameter list, I guess
Anonymous
@unterumarmung you mean something like "void foo(char** out);" ?
Anonymous
so you return a raw pointer via the parameters?
Anonymous
iirc unique_ptr is just an address too.
Unique ptr contains not only a raw pointer
Anonymous
That seems strange.
Anonymous
I mean: Convert int func(); To void func(int* param);
Anonymous
Or void func(int& param);
Anonymous
ah, I'm not sure he meant that.
Anonymous
I can't guess what he meant
Anonymous
Unique ptr contains not only a raw pointer
It also stores a deleter function since you can provide custom deleter functions for your pointers
Anonymous
Ah, interesting, TIL.
Anonymous
Thanks!
Anonymous
So 2 pointers in total then?
Anonymous
Why pointers?
Tushar
/get
Dima
you can return a value with rvo supported
Tushar
/rules
Dima
instead of passing as a reference and getting a result
Anonymous
One pointer and one function
Dima
check out the rvo stuff
Anonymous
I'd assume they'd use a pointer to a fucntion.
Anonymous
No
Anonymous
Callable object is not only a pointer to function
Anonymous
Also lambdas and functors — class objects with overloaded operator()
Anonymous
You can provide your custom types for a deleter function
Tushar
/get notes
Tushar
/list
Tushar
/get names
Anonymous
@Dragon_Trainer786, stop spamming
Tushar
I want to study complete c++ so I am trying to get notes through rose
Tushar
Can you help me?