Ибраги́м
Anonymous
yep
Anonymous
with one or 2 c++ calls
Anonymous
because c++ is scary
Dima
Anonymous
i do understand it
Anonymous
but there are so many issues
Anonymous
especially with error handling
Anonymous
that i found it better and more effective to just use error numbers
Dima
runtime or @ compile time?
Anonymous
instead of exceptions
Anonymous
runtime
Dima
lol exceptions in c++
Dima
rip
Anonymous
compile time are fine
Anonymous
i fix those easily
Ибраги́м
Exceptions is for Exceptional cases
Dima
everyone does that
Ибраги́м
Plus exceptions are banned in embedded environment mostly anyway
Anonymous
yep
Anonymous
for good reasons
Anonymous
they are broken ass shit
Anonymous
i tried using them for a while and now we have to go through all that code and change from exceptions
Anonymous
back to error numbers
Anonymous
because exceptions do not propagate
olli
What is broken?
Anonymous
exceptions in C
Ибраги́м
back to error numbers
There's reason ASIO provided exception and asio::error_code interface.
C++ do have a std::error_code tho.
Ибраги́м
Ибраги́м
RIP
Anonymous
i make my own error codes
Anonymous
fuck that
Ибраги́м
Good luck
Dima
aka goto error;
Anonymous
like deallocating memory that was allocated
olli
Dima
Anonymous
if i have:
void func()
{
int *t = malloc(1);
throw exception...
}
Anonymous
that is a memory error
Anonymous
memory leak
Dima
> malloc
> throw
ohh boyyyy
Dima
mixing both
Anonymous
or you can use new
Anonymous
Anonymous
mixing both
we have this quite a lot actually
Anonymous
because of the other C master race programmers
Anonymous
Anonymous
before i throw i deallocate
Anonymous
so i do a free
Anonymous
but they do not bother
Dima
what about nasty shared_ptrs
Dima
in cxx
Anonymous
NO
Anonymous
FUCK THAT SHIT
Anonymous
HATE THOSE
olli
why not
void foo() {
std::unique_ptr<int> ptr = std::make_unique<int>();
throw whatever();
}
Dima
they quite help in big projects
Dima
lol so close
Anonymous
I love shptr
olli
will never leak
Anonymous
they may but i hate them still
Ибраги́м
Ибраги́м
Gotos... hehe
Ибраги́м
That's Epyc!
Anonymous
Anonymous
i use gotos in any function that has multiple return positions
Anonymous
to centralize one return position
Anonymous
allowing me to have free in one position
Dima
good designed func wouldn't have many returns
Anonymous
Anonymous
olli
Anonymous
I don't use it much often
Anonymous
Anonymous
🤣🤣who won in the end