BinaryByter
but why doesnt the code work you used?
Nomid Íkorni-Sciurus
looks like it does extend exception
Nomid Íkorni-Sciurus
BinaryByter
I don't know
lets not try understanding compilers
Nomid Íkorni-Sciurus
If I catch(std::logic_error) { }, gdb says unknown signal recieved
BinaryByter
lol
Nomid Íkorni-Sciurus
it doesn't work if I catch(std::exception) either
BinaryByter
lol
Nomid Íkorni-Sciurus
lol
Maybe it is a msys thing
Nomid Íkorni-Sciurus
lol
looks like current_exception() works though.
Nomid Íkorni-Sciurus
} catch(...) { cout << current_exception().__cxa_exception_type()->name() << endl; } This is implementation-specific but works 😐
Nomid Íkorni-Sciurus
BinaryByter
just go for clang please
Nomid Íkorni-Sciurus
just go for clang please
lldb doesn't work well in msys :(
BinaryByter
lol
Pradyumn
I agree with rule.
Prometheus
I agree with rule.
You’re a good man.
Pradyumn
Thanks
Nomid Íkorni-Sciurus
lol
looks like clang has several linking issues in msys. I should try the Windows version.
Nomid Íkorni-Sciurus
also libc++ seems to be bugged in the msys version
BinaryByter
Nomid Íkorni-Sciurus
Hm... the TDM MinGW64 version of g++ looks to be working fine
Nomid Íkorni-Sciurus
try msvc
I need my code to be platform independent (at most)
Nomid Íkorni-Sciurus
only in the msys version?
I didn't try the official binaries yet.
Nomid Íkorni-Sciurus
Hm... the TDM MinGW64 version of g++ looks to be working fine
I suspect the msys version of the gnu suite to be bugged anyway.
Nomid Íkorni-Sciurus
then dont use exceptions
what do you mean?
Nomid Íkorni-Sciurus
aren't c++ exceptions portable?
Nomid Íkorni-Sciurus
Anyway, it looks like libc++ doesn't support windows in any way (officially)
Nomid Íkorni-Sciurus
I AM STUPID.
Nomid Íkorni-Sciurus
I was catching an exception instead of an exception*
BinaryByter
aren't c++ exceptions portable?
some systems might not implement them well
BinaryByter
example: embedded systems
Nomid Íkorni-Sciurus
Oh, it's not going to be that portable
Nomid Íkorni-Sciurus
huh?
my targets are desktop systems, mostly gnu/linux and windows. FreeBSD and OSX are planned but I'm not sure about that.
Nomid Íkorni-Sciurus
right
speaking of which, do you know any good cross-platform GUI libraries? I was considering FLTK
BinaryByter
Meh
BinaryByter
go for WxWidgets
Nomid Íkorni-Sciurus
go for WxWidgets
why wx, is there a particular reason? I know it's full-featured anyway
Nomid Íkorni-Sciurus
gdb exits with "Signal received: ? (Unknown signal)"
Nomid Íkorni-Sciurus
It works if I try to catch a pointer to the exception instead.
Nomid Íkorni-Sciurus
try { thing_that_throws(); } catch(logic_error *e) { cout << e->what() << endl; } this works.
Nomid Íkorni-Sciurus
olli
what new?
#include <iostream> #include <exception> void code_that_throws_logic_error() { throw std::logic_error( "Cannot instantiate a Nut with no content"); } int main(int argc, char **argv) { using std::cout; using std::endl; try { code_that_throws_logic_error(); } catch(const std::exception &e) { cout << e.what() << endl; } return 0; }
Nomid Íkorni-Sciurus
Yeah, that works!
Nomid Íkorni-Sciurus
Nomid Íkorni-Sciurus
I was catching an exception that was not being thrown.
olli
So, this is just a type mistake.
gdb basically quit because neither you nor gdb did not catch the exception
BinaryByter
Qt is full of huge dependencies, bloat and weird constructions
Nomid Íkorni-Sciurus
What else to use?
I don't know. I'm quite new to C++ GUI programming.
olli
what new?
You did throw new ... I would stronglly suggest not to do it. In this case you are responsible for the exception allocation and deallocation and it's very hard to tell when it's safe to relrease the memory. Rather throw exception and catch by const reference
olli
I don't get people accusing compiler of bad code-gen if they don't even know what's wrong in the C++ code ... feels bad..
Nomid Íkorni-Sciurus
I don't get people accusing compiler of bad code-gen if they don't even know what's wrong in the C++ code ... feels bad..
I didn't asssume anything, I actually asked just why it didn't work. There's to say, I didn't specify how I threw the exception. My bad.
Nomid Íkorni-Sciurus
Anonymous
Termux User here
BinaryByter
Nothing wrong :) This message was not intended for you
You know, if my code works but doesnt anymore when i use O3, i'm pretty sure that we can blame the compiler ;)
BinaryByter
new and delete are bad habits in Cpp
olli
If you did, you were required to somehow reimplement parts of the whole exception system. Becaue you need to handle special cases, such as rethrowing and stuff
olli
You know, if my code works but doesnt anymore when i use O3, i'm pretty sure that we can blame the compiler ;)
no.. because this applies to both GCC and Clang. So chances are your code is wrong
BinaryByter
Optimization doesnt change the standard
olli
it's always easier to blame the compiler
Nomid Íkorni-Sciurus
new and delete are bad habits in Cpp
I see. That is because you need to be sure when to delete the allocated memory.