Ludovic 'Archivist'
Which happen to clear also the other resources
Ludovic 'Archivist'
with a taste of overhead
unique_ptr have no overhead compared to new+delete
MᏫᎻᎯᎷᎷᎬᎠ
MᏫᎻᎯᎷᎷᎬᎠ
It's nearly the same
BinaryByter
one calls the destructor
BinaryByter
the other doesnt
MᏫᎻᎯᎷᎷᎬᎠ
unique_ptr use delete in its destructor right?!
BinaryByter
no
BinaryByter
it calls the destructor
MᏫᎻᎯᎷᎷᎬᎠ
Which happens a job of freeing resources
MᏫᎻᎯᎷᎷᎬᎠ
Hmm?
MᏫᎻᎯᎷᎷᎬᎠ
it calls the destructor
Of course it does
MᏫᎻᎯᎷᎷᎬᎠ
No stack object passes its scope without calling its destructor
BinaryByter
think
Anonymous
unique_ptr use delete in its destructor right?!
unique_ptr calls delete in its default_deleter, which is called in reset(), which is called in the destructor iirc
Anonymous
Ok
Talula
Smart pointers don't free memory, they delete object
I'm not in favor of smart pointers anyways.
BinaryByter
why not?
Dima
me too
Dima
I prefer raw pointers lol, but I have abstractions above it
Anonymous
I prefer raw pointers lol, but I have abstractions above it
Better than nothing. If I use pointers in C++ I always prefer Smart Pointers
Anonymous
It just fucks up some C APIs
Anonymous
Ludovic 'Archivist'
I'm not in favor of smart pointers anyways.
And I say that when you have to pass data between threads, unique_ptr is life
Anonymous
K
Anonymous
any sololearner here?
Anonymous
Ludovic 'Archivist'
MongoDB have no transactions
Ludovic 'Archivist'
I advise Cockroachdb
BinaryByter
Is it a thing in C++ as well?
Anonymous
@linuxer4fun yes
swarnim
I advise Cockroachdb
That's quite hilarious for some reason.
Anonymous
I advise Cockroachdb
Ty, i am looking into that tbh.. XD
Anonymous
It even has support for kubernetes!
Anonymous
I advise Cockroachdb
You have any personal experience with such applications?
Ludovic 'Archivist'
You have any personal experience with such applications?
I don't use it because I create database software, but I use the same algorithms as they do
Anonymous
I don't use it because I create database software, but I use the same algorithms as they do
I see, it's not the creating my own db that was hard, but the failsafes that i have to make wich i have no knowledge of.
Anonymous
Just scared tbh
Mihail
I advise Cockroachdb
Tbh it sounds like something you wouldn't want to have in your code
Ludovic 'Archivist'
Tbh it sounds like something you wouldn't want to have in your code
It is named that way because killing the cluster is hard
14•08
For what? Try doing Windows Application in C and try to compile it on Linux.
Mmh Linux ts very complicated and not user friend but c is better bcz it convenient
Talula
Mmh Linux ts very complicated and not user friend but c is better bcz it convenient
Yeah if you're making a DOS based application in 2019... yeah with printf but just try string operations in C and see.
olli
C isn't even used in Embedded System programming anymore.
That's not true at all. More and more embedded systems use c++ nowadays but C is still used as well
klimi
#ot
Anonymous
That's not true at all. More and more embedded systems use c++ nowadays but C is still used as well
Yeah, many companys and microcontrollers still use C, for a good reason. It depends on which level you develope your systems. For modern IoT stuff C++ is used, for real low level embedded devices, C is still predominant
olli
Yeah, many companys and microcontrollers still use C, for a good reason. It depends on which level you develope your systems. For modern IoT stuff C++ is used, for real low level embedded devices, C is still predominant
I don't think it's primarily about the level but rather about the available tools and compiler and requirements. For modern IoT even JavaScript or Python are used
Anonymous
I don't think it's primarily about the level but rather about the available tools and compiler and requirements. For modern IoT even JavaScript or Python are used
One main reason why C is used on very low level is the ability to use it without runtime deps, the binary size and you can better predict the generated code.
Anonymous
Yep
olli
One main reason why C is used on very low level is the ability to use it without runtime deps, the binary size and you can better predict the generated code.
You can also use C++ in freestanding mode to prevent linking against libstdc++ or whatever. The resulting binary is not larger than using C
Anonymous
CThe company I've worked for develops IoT. They highly use C++ and a OS called RTOS. The whole package (OS + Firmware) is just about 7MB in size and can be downloaded and installed with a bad modem signal quality.
Anonymous
I think C is more dominant in driver development
Anonymous
I know. But using C++ without runtime deps or templates isn't that much fun. Also, most of the time you don't *need* C++ on bare metal level.
Anonymous
jupp
Anonymous
We never needed it there
Anonymous
Anonymous
Templates bloat the binary
Anonymous
On bare metal, the code should be easy. Using fancy C++ stuff, where you have no control what the compiler does, can get a shoot in the own foot
Anonymous
Thats why I said it depends on the level
Anonymous
If you're on IoT and has a OS on it, C++ is great
Anonymous
On bare metal it can be much pain
Anonymous
yeah
14•08
Guyz iwrote a program but it has brought me logical error and i can't identify it.can any 1 help me?
14•08
14•08
olli
Templates bloat the binary
There are cases where using templates yielded smaller binaries as well.. So this is not generally true
BinaryByter
+ compiler optimization unbloats everything
Anonymous
@olli: I think Shelly doesn't meant the rare cases where it *can* be an advatage to use templates. In my personal experience, escpecially MTP, caused for frustations when bugs needed to be fixed and the original source code author has left the company. It is more about control over the code and the behaviour of it.
Anonymous
@maximilian: The compiler can optimize better if the programer also knows how the optimizer/compiler works. I wouldn't rely on compiler optimization alone
BinaryByter
I would
BinaryByter
becuase the compiler knows what its doing
BinaryByter
and it gets better and better