« first day (439 days earlier)      last day (4513 days later) » 

Xeo
10:00 PM
@MooingDuck No, only if the exception is not catched
 
@Xeo Oh, GCC 4.7 does that to me too.
 
Xeo
I suddenly suspect a faulty compiler switch...
But "Enable C++ Exceptions" is set to "Yes (/EHsc)"
grrrr
 
blogs.msdn.com/b/davidklinems/archive/2005/07/12/438061.aspx " the debugger gets notified whenever an exception is encountered At this point, the application is suspended and the debugger decides how to handle the exception. The first pass through this mechanism is called a "first chance" exception. Depending on the debugger's configuration, it will either resume the application and pass the exception on or it will leave the application suspended and enter debug mode."
 
hmm, what's an e-closure (where e is empty string)?
 
sounds like what I described. You're thinking of "unhandled exception". That's different.
@Xeo you should have a continue/ignore option
 
Xeo
10:02 PM
C'mon, normally my exceptions work too
 
@Xeo also stackoverflow.com/a/1716418/845092 might be relevant
 
Xeo
int main(){
	try{ throw 5; }
	catch(...){}
}
"first-chance exception"
RARGH
 
@Xeo What are the buttons on the dialog. If there's a continue/ignore, did you try that?
 
what's wrong with "first-chance exception" ?
 
Xeo
@Abyx See that try-catch block?
 
10:04 PM
it's just a line of log %)
yep
 
Xeo
See, there should be no "first-chance exception"
 
why?
 
Xeo
@MooingDuck Ignore -> "A buffer overrun has occurred in Blargh.exe which has corrupted the program's internal state."
x_X
ZA FUCK!
 
@Xeo whoa, that's not right. Firing up MSVC....
 
Xeo
Ha
 
10:08 PM
working on my MSVC10
 
Xeo
I'm at fault
 
@Xeo well obviously
 
Xeo
Debug -> Exceptions... -> "C++ Exceptions" where all turned to "on", so it really broke at the point the exception was thrown
 
Isn't that what I said from the beginning?
 
Xeo
Did you?
I might have overlooked that
 
10:10 PM
@Xeo doesn't MSVC do that when the exception is thrown? If so, no destructors have run yet [13:59]
@Xeo also stackoverflow.com/a/1716418/… might be relevant [14:02]
 
Xeo
♪~
2
 
and two other messages, one with a quote from the MSDN. :D
 
Xeo
I know nothing, my name is Bunny.
 
@Xeo you had me seriously confused :P
what confuses me is my MSVC10 doesn't have a debug->exceptions
 
Xeo
if(std::uncaught_exception()){
    // stack unwinding
    try{
	    throw;
    }catch(...){
    }
}
Sadly, that calls std::terminate :(
I thought I could get at the uncaught exception with that
 
10:13 PM
right, can't throw if there's an uncaught. You'll have to store it later until the exception is caught. I can't think of a way to "stop" the catch and throw something else.
 
Xeo
The problem is, how would you store that uncaught exception?
 
@Xeo of course you can't, it's because of SEH - you can't throw in exception handler
 
@Xeo however, you can store the new exception for later.
 
Xeo
@Abyx That's not because of SEH (which is Windows specific), but because the standard says so
 
@Abyx I don't think SEH is related
 
10:15 PM
even if standard would allowed it, SEH doesn't
 
Xeo
SEH and C++ exceptions are orthogonal. SEH is for hardware exceptions like 1/0
 
@Xeo not in VC++
- in VC++ all exceptions are SEH exceptions, and all unwinding is done via SEH
 
@Abyx even in MSVC. Though MSVC10 has an option to turn SEH options into C++ exceptions.
@Abyx which version? (and source if you got one)
 
@MooingDuck any version.
throw is implemented via RaiseException
 
@Abyx no. In MSVC10 I get a warning for catch(...) that says it does not catch SEH exceptions, unless I turn on a special compiler option. I think SEH exceptions were C++ exceptions in MSVC9 though.
 
10:20 PM
What do you mean by "I think"? Check it.
/EHa is only for catch(...) behavior
not for try\catch implementaion
 
@Abyx Actually, judging by msdn.microsoft.com/en-us/library/swezty51(v=VS.90).aspx, microsoft implies SEH is a subset of C++ exceptions, not the other way around. C++ exceptions are more flexible than SEH
 
btw, VC++ does stack unwinding on #AV
SEH has nothing to do with C++. It's part of OS
 
@Abyx I forget what we're debating. Are we debating?
 
well... I don't think we do
 
@Abyx oh: "SEH and C++ exceptions are orthogonal.". You're right, they are not orthogonal.
The whole RAII-destructor-exception/exception stack thing could be done away with entirely if C++ simiply said "destructors are nothrow". I can't think of a legitimate use for throwing exceptions from destructors.
 
10:27 PM
as I said, there is code which uses throwing dtors
Stroustrup wrote about it... Let me find the article...
 
@Abyx probably, but should it?
 
Xeo
I think someone mentioned network code and timed out connections some time ago in here
 
www2.research.att.com/~bs/bs_faq2.html#ctor-exceptions Stroussup says don't throw exceptions from destructors.
@Xeo I did, but RMartinhoFernandes said in that case it should be handled in the destructor. Which makes sense.
 
Xeo
Even better, if a connection is already timed out, just don't throw any exception. Why fail to disconnect when you're already disconnected?
 
@Xeo if you have resources on that machine, and the destructor exits, there is no way to know which resources were just leaked. No logging, no debugging, no contact-them-later, nothing. Seems like a violation of RAII.
40
Q: throwing exceptions out of a destructor

Greg RogersMost people say never throw an exception out of a destructor - doing so results in undefined behavior. Stroustrup makes the point that "the vector destructor explicitly invokes the destructor for every element. This implies that if an element destructor throws, the vector destruction fails... The...

first answer observes that ofstream's destructor can leak resources.
This exception stack thing would be easier if a handler could throw into itself.
 
Xeo
10:38 PM
@MooingDuck like how?
 
catch (std::exception& up) { throw up; }... :)
(sorry no relevance, just couldn't resist)
 
Well hi there
 
@Xeo the problem with that is you'd have to be handling the current exception, whereas a destructor isn't doing that.
 
Xeo
This wasn't meant as an answer to anything, I just liked the example. :)
I'll just just copy-paste that code in a .h and save it for later :D
 
10:46 PM
@Xeo catch (std::RAII_dest_error& next) {next.retry(); if (exceptionstack.size()) throw exceptionstack.top();} <-- and it throws into itself. But that doesn't work in C++.
 
Xeo
while loop :/
 
@MooingDuck: I don't blame you for missing my lame joke. I was throwing up
 
Xeo
and everything in the try-block
 
@sehe I liked it
 
Xeo
@sehe You too got that from an answer on SO
:P
 
10:48 PM
@Xeo Yeah that makes a lot more sense.
 
I think I invented it. I wouldn't be completely surprised if I used it in an answer of mine. But I don't recall using it outside one of my employers codebases :)
 
@sehe I also just noticed this makes a copy of the exception. The proper way to resume is just throw;. Still funny though.
 
Xeo
> We will be offline for maintenance for 15-20 minutes at 0:00 UTC (7:00PM EST)
Noooo~
 
@Xeo we who?
 
Xeo
SO
 
10:52 PM
I think the RAII_destructor_error/exception_stack concepts can only work if RAII_destructor_error is an abstract class. Actually, it also provides the option to move the resource deallocation to any arbitrary point after a failure.
 
Xeo
@MooingDuck Yep, with templated derived to store the exception
Can't work any other way
Or atleast that's by far the easiest
    // Anonymous Poem (i.e. I don't know the author)
    I Hate Programming.
    I Hate Programming.
    I Hate Programming.
    It works!
    I Love Programming.
And conversely:
I Love Programming.
I Love Programming.
I Love Programming.
Fuck!
I Hate Programming.
 
@Xeo so the proper way to handle any exception is to catch(/*stuff*/) { /*handle*/; while(exceptionstack.size()) {try {exceptionstack.top().tryagain(); } catch(...) { /*????*/} exceptionstack.pop();} }?
 
Xeo
@MooingDuck Ugh :s
 
I dislike where my idea is going :(
 
I love ProSegmentation fault.
 
10:58 PM
@Xeo so in the case that a destructor fails, what should the proper method be? :( I can't think of what should happen.
 
struct S { S(); ~S(); }; S();
am I guaranteed S() will instantiate?
 
Xeo
@MooingDuck Time should rewind itself.
@wilhelmtell There is no return value
 
yes yes, sorry. I mean, can it be optimized away?
 
hey
 
@wilhelmtell depends on what S() does, but usually it won't be optimized away. If S() is effectively a constexpr it could be.
 
11:00 PM
I'm looking for a C or a C++ lib which renders SVG to a bitmap.
I wonder what WebKit uses.
 
imagemagick?
 
Xeo
Damn, I know there was a "best source comments" thread on SO, but I can't find it...
 
@Xeo there could be an exception handling thread which occasionally calls bool tryagain() on each RAII_dtor_exception every 30 seconds and remove those that succeed...
 
Last time I used ImageMagick I found the documentation to be rather lacking. It took a lot of trial an error to get something going, and when you go through trial and error like that you never feel certain that what you have is concrete
 
Xeo
11:02 PM
No, really for source code comments
 
struct statement {
    statement(std::string const& sql) { prepare(sql); }
    ~statement() { evaluate(sql); }
};

struct transaction {
    transaction() { statement("BEGIN TRANSACTION"); }
    ~transaction() { statement("END TRANSACTION"); }
};
 
Xeo
@MooingDuck Thanks, that's what I wanted
No wonder I can't find it if it's deleted
 
if the temporaries can be optimized away then i can end up with BEGIN without END, or END without BEGIN, or none at all.
 
11:04 PM
23
Q: Why were historically significant questions deleted?

amanaP lanaC A nalP A naM AFor example: This question: What are some funny loading statements to keep users amused? used to have this notice on top: But since then it has been deleted on November 9th. I have seen this with a few of the historically significant questions like What is the best comment in source code you ...

 
@wilhelmtell no, because if the temporary is optimized away, you have one less constructor, and one less destructor. There's still a 1-1 everywhere, on each object.
 
no. if the temporary can be optimized away then it can also not be optimized away. optimize it away in the ctor, keep it in the dtor. so, can the temp be optimized away?
 
Xeo
It can't optimize one or the other
 
my gut feeling is that it shouldn't because the would affect the observed behaviour. but then, RVO is allowed to change the observed behaviour.
 
@wilhelmtell in your code, there's two temporary statements, and neither can be optimized away.
 
Xeo
11:07 PM
How would you call a destructor for an object which had the constructor optimized away and vice versa?
 
mm?
the constrouctor can't be opitmized away. it's the CALL to the ctor that (i'm asking if) can be optimized away.
so:
int i; // never used
 
Xeo
Still, how so?
 
i might be optimized away.
3
 
@wilhelmtell as far as I can tell, nothing in your code can be optimized away, except for temporary transactions.
 
but that's ok because it has no ctor or dtor with observed behaviour.
 
Xeo
11:08 PM
If the observable behaviour of the code isn't change, anything can be optimized away
 
that's not the case in statement and transaction
 
@wilhelmtell in that case i has no side effects. transaction i; does, and thus cannot be optimized out. You're still safe.
 
@MooingDuck but that's exactly what i'm asking. if those temporary transactions are optimized away then the observed behaviour will be different.
 
Xeo
The optimizer is only allowed to optimize away observable behaviour in case of copy elision
 
11:10 PM
@wilhelmtell oh, you mean transaction a; a=transaction();? In that case RVO will change obvservable behavior.
 
@MooingDuck but supposed i had a function that returns a transaction by value. then there are at least two copies being made. RVO an jump in and change the observed behaviour. i'm asking if other optimizeations can do that too. it feels shaky.
 
@wilhelmtell no, RVO is an exception to a rule. In all other cases, the compiler isn't allowed to change observable behavior.
 
so, instantiating an object with none-trivial ctor/dtor will never optimize away?
even temporary?
 
Xeo
2 mins ago, by Xeo
The optimizer is only allowed to optimize away observable behaviour in case of copy elision
 
11:15 PM
@Xeo woah excavations there! Very very nice reads
 
@JohannesSchaublitb can't believe i'm reading a blog post from the future! It's still December 29 here. :)
2
 
Xeo
It's a kinde of archive binge every time I open it though. :s Same with other "fun" threads.
 
@wilhelmtell What: you have no observable behaviour? Then you must be well mannered, since you never misbehave either
 
@JohannesSchaublitb Why do you waste so much time on useless template wankery? Can't you focus your energy on quantum computing (or whatever the next big thing is) instead? ;)
 
11:25 PM
im sorry. no
template metaprogramming IS the next big thing
 
@FredOverflow (to be read in a highly constructive tone of voice, of course)
 
the entire universe runs on templates :(
 
I strongly doubt that.
 
@Xeo it dawns on me that the RAII_dtor_error/exception_stack is effectively a delayed/retriable finalizer. Java has delayed finalizers but I don't think they're retryable.
 
the whole milkyway is a big template instantiation backtrace.
3
 
Xeo
11:28 PM
@JohannesSchaublitb With a parser error somewhere in the middle?
 
i guess we are the step when it tried to instantiate ioMANip xD
 
Xeo
lol
 
We are the world in hello world.
 
@FredOverflow hello
 
hello what?
 
11:31 PM
@FredOverflow hello world.
 
That's right.
 
no we are the exceptions thrown from the universes destructor. Now, we are still to decide whether God or Satan implement longjmp in the universe just to keep us around longer
 
I think our babies' first words should be "hello world", not "mama" and "papa".
What do exceptions have to do with longjmp?
 
let them start with 'int main'
 
"burly bace!" - "That's right, curly brace!"
 
11:32 PM
@FredOverflow arguably the only way to 'escape' from a std::terminate-bound stack-unwinding
@FredOverflow And the moms would all be saying: "Isn't that cute?" And the grandpas will be muttering "Hrrrm in my days we'd be talking lisp by now"
 
lol
We should give our babies the towers of hanoi for Christmas!
 
Make it 7 towers and you'd be done for two years of christmas at once.
Hope they don't go at it recursively or they will find out about stackoverflow a little prematurely
 
You should give them a stackoverflow account early on. Their first question will probably be "gfbbbbbbfbgffgbg" or something.
 
luckily, there is spelling correction
 
11:38 PM
alias (hmmm. or more accurately ?)
 
dna = duke nukem atlast? :)
 
I'm back!
but I'm already pissed..
 
<!-- puts refp on ignore -->
 
@sehe I'd recommend something a long those lines, yes.
 

« first day (439 days earlier)      last day (4513 days later) »