« first day (907 days earlier)      last day (4267 days later) » 

22:00
"Damn, it feels good to be a gangsta!"
got no solution ! :(
@DomagojPandža Awwww yeah I'm gonna watch it right this instant
Bill Gates doing some chairity work
Yeah that was my second fav comment. I decided not to flood the room with YT comments though, so thanks for posting it :)
@R.MartinhoFernandes by the way, boost has wait_for_any
22:05
how do I put an exception specification on a lambda function?
just noexcept(true) after the arguments?
You don't
oh
that's silly.
silly you, Standard.
Seems like an omssion. However, why should it matter?
user142019
22:05
Propose it.
I have no idea.
I said that randomly.
It's not like you should override a noexcept member (since there will be no baseclass) and you're not implementing member swap or rvalue-ref-assignment or something funky like that
@sehe Presumably because I'd like to guarantee the noexceptness of a function call.
How/why
by static_asserting noexcept(f()).
22:07
Okay. That's a (minor) usecase I guess
@R.MartinhoFernandes I was thinking about Ogonek, if I have a function that takes arbitrary decoding iterators and uses the utf-8 encoding iterators to encode them to a stream, do you have a way to optimize the utf-8 -> utf-32 -> utf-8?
how is the noexcept spec of f() any more or less useful than the noexcept spec of the move constructor, say?
Because it is frequently a source of optimization opportunity?
I'd suspect more likely that the Committee simply did not consider the exception spec of things like std::less.
@DeadMG can a noexcept function contain a lambda that throws an exception or would any contained lambda be inherently also noexcept?
@DeadMG too hard
@DeadMG can you write a std::less that's nothrow if A<B is nothrow? I'm not sure how that'd work exactly.
22:11
@MooingDuck Of course (ahem, I parsed a "not" that didn't exist).
user142019
@MooingDuck yes.
but the point is that I bet you that std::sort depends on it's comparator being nothrow.
Why would a comparison operator... throw?
@DeadMG I doubt it, since there's no requirement that moves are nothrow either.
@MooingDuck Er, there absolutely is.
as far as the entire Standard Library is concerned, either your moves are nothrow or they don't exist.
22:13
@DeadMG oh
Ell
Ell
Lol my friend is doing "like for a hurtful comment"
@DeadMG even though my statement was dead wrong, I just realized my point stands. Copies can throw.
@MooingDuck Right now I don't have that, but I plan to. When I finish getting rid of iterators I will have support for tagging ranges types with arbitrary info. The main goal for now is to skip redundant well-formedness checks and redundant normalizations, etc, but after I get the big parts done I can easily add specialised code paths like that.
no wait, sort requires movable types? darn it
@MooingDuck Your point is: some things don't need to be nothrow, so std::less doesn't need to be? It could very well allow the stdlib to insert optimizations that it otherwise couldn't
22:17
(Note that that can only be done if the source is guarantee well-formed)
@R.MartinhoFernandes yeah, I was just thinking of a utf8_encoder<utf_decoder<base_iter>> specialization. There's probably other similar optimizations that can be thought of.
@MooingDuck Right. But the nothrowness or not of copying or moving is important- for example, if there is a move but it throws, there are no algorithms that are exception safe which can move stuff in case of, say, vector resize.
Ell
Ell
@scottw SSH? :3
@MooingDuck Yeah, I have a bunch of them thought up, but I realised I need to build some robust machinery first to make them easy to add without disturbing existing code, so I am rewriting some bits.
(And getting rid of iterators and Boost.Range)
@sehe my points were that (A) I can't think of a way to correctly mark std::less as nothrow IFF A<B is nothrow, and (B), std::sort says nothing about exceptions being UB or whatever.
22:20
Notice how there are different balloons for "seq code units E" and "encoded<E>".
@MooingDuck Er, that's half the point of noexcept. struct std::less { bool operator()(const T& lhs, const T& rhs) noexcept(lhs < rhs) { return lhs < rhs; } };
@DeadMG I believe this but can't find it in the spec ATM
The latter is a known-valid encoded string, the former is arbitrary and needs to be validated.
If I specialize for the latter, I can skip some steps.
Ell
Ell
There are SSH servers for windows
@DeadMG I forgot you could put arbitrary expressions in a noexcept, my bad.
still doing C++03 at work >.<
22:22
In fact, I can just write a generic shortcutting encoding optimisation: any (well, some) chain of encode/decode ranges gets flattened to at most one encode/decode pair.
VS doesn't support noexcept anyway
so I couldn't have made use of it.
what's the purpose of try-catch-ctor's if this.. well, why isn't this exception caught? ideone.com/D41M9Z
So utf8 -> utf32 -> utf16 -> utf32 -> gb18030 -> utf32 -> utf16 becomes a simple utf8 -> utf32 -> utf16, which can then further become utf8 -> utf16 if I add specialised code for that conversion.
Sounds like fun TMP.
@refp that's a really good question
However, utf8 -> utf32 -> ascii -> utf32 -> gb18030 -> utf32 -> utf16 cannot be optimised further than utf8 -> ascii -> utf16 because ascii is lossy.
22:24
@refp There is basically no purpose to them.
Meaning I need to tag encodings with that property.
@R.MartinhoFernandes encoding::is_lossy<other_encoding>.
@CatPlusPlus meow
user image
9
oh god.... what have you done
@DeadMG I've been going through the standard and is it just me if I consider it to be a bug (that it isn't caught?) or am I reading it wrong? maybe it will only catch exception thrown from the ctor's of the members of the object, but that would be weird as well.
22:26
@refp I think it's a bug
user142019
@melak47 more like "meh grump grump".
@refp I've never considered this feature in detail, since it seems to be totally fucking worthless, but I don't think it is supposed to be caught.
@DeadMG what is supposed to be caught then?
nothing
@MooingDuck what makes it even more weird is that clang refuses to compile the example
22:27
@melak47 lol
you simply watch as it flies past you (and possibly notify someone)
but not with errors, with undefined references to.. a lot of things
@DeadMG Not sure if such detail is worth it. I was thinking of a simple bool can_encode_everything.
@DeadMG oh, hmm
oh, man
22:27
I guess I was pretty bored.
There aren't many encodings that share their entire charset.
I could use that to implement the exception information adding thing
@DeadMG nope, you never end up in there it seems
@refp That's definitely not correct, I think
@DeadMG yeah, some sync problem on the host I tried it on
22:28
@Zoidberg what happened to your avatar?
it was still compiling the old source
user142019
@melak47 As you can see, it has changed.
@DeadMG but honestly though, what's the true purpose.. a fancy method for notifying that an exception was thrown, but you can't do nothing about it?
@refp As far as I am aware, it serves no useful purpose.
@DeadMG I guess the only interesting cases I miss with a single bool are in ascii -> some_ascii_superset_codepage -> X, and who the fuck needs that?
22:30
nhaa the standard is all fuzzy, in it's example it clearly states that the catch-block // handles exceptions thrown from the ctor-initializer and from constructor statements
Ell
Ell
@r.martin would utf8->utf16->utf8 be optimised out completely, or would it still have to be validated?
^ @DeadMG see the previous message from me
@Ell Assuming the input is known-valid, no validation.
In the graph I posted above, anything to right of the "well-formed" balloon skips validation (when possible).
§25.4.1.1 sort... Requires:... The type of `*first` shall satisfy the requirements of `MoveConstructible`. §17.6.3.1 `MoveConstructable` requirements <no mention of exceptions>. §20.2.3 `template <class T> typename conditional<!is_nothrow_move_constructible<T>::value && is_copy_constructible<T>::value, const T&, T&&>::type move_if_noexcept(T& x) noexcept;` §23.3.6.3 [vector.reserve]... If an exception
is thrown other than by the move constructor of a non-CopyInsertable type, there are no effects.
(see full text)
Ell
Ell
I find it amazing how one person can come up with and code such a genius library
22:32
Hmm, maybe I could have bool superset_of_ascii, and bool full_unicode_charset.
Ell
Ell
And code it too
it certainly sounds like vector takes into account throwing move constructors.
@Ell He hasn't coded it yet.
@MooingDuck IIRC it uses move_if_noexcept, which copies if throwing.
alright, I'm posting this as a question..
22:33
that's the whole "I'm thinking about things I might do in the future".
@R.MartinhoFernandes I can't find anything in the spec that mentions that
it's like me talking about how sexy Wide is.
well, to a point, anyway
@DeadMG It's more about the things I will make easy with what I am doing right now.
fair nuffs
found something § 23.3.5 "If an exception is thrown other than by the copy constructor, move constructor, assignment operator, or move assignment operator of T or by any InputIterator operation there are no effects. If an exception is thrown by the move constructor of a non-CopyInsertable T, the effects are unspecified."
22:35
@refp Your code has UB (§15.3/10): "Referring to any non-static member or base class of an object in the handler for a function-try-block of a constructor or destructor for that object results in undefined behavior."
@JerryCoffin oh I missed that
good find
@MooingDuck Then it is/was libstdc++'s implementation. There might have been DRs on this.
@JerryCoffin but incomplete
@R.MartinhoFernandes 23.3.5 says move-if-nothrow, otherwise copy if possible. If move throws and there is no copy, move anyway, and exceptions are then UB.
@JerryCoffin then why does the standard have an example which is pretty much the same exact thing? :(
Can anyone take a look to my question please : stackoverflow.com/questions/15784861/…
22:37
@refp where?
@MooingDuck chapter 15, thingie 4
@MooingDuck cpp_standard.ISO.IEC.14882-2011.pdf
I don't have that.
@refp can't find it
(And I don't care: the corrected version is what matters)
@JerryCoffin oh well, the i = ... part is UB that's true
22:40
WHEEWW
@MooingDuck sorry the i = ... was a left-over thing, that was just me seeing if the compiler would say anything with warnings set to max, it's not really relevant to my question about the purpose behind ctor-initializer + function-try-catch
Major refactor almost complete.
@refp Do you mean 15.4 or 15/4?
The API is getting STRONGER. <3
@JerryCoffin 15.0/4 (let's pretend indexing in the standard also start at 0)
15 Exception Handling, section 4
22:42
C::C(int ii, double id)
try : i(f(ii)), d(id) {
    // constructor statements
}
catch (...) {
    // handles exceptions thrown from the ctor-initializer
    // and from the constructor statements
}
@R.MartinhoFernandes precisely
Precisely what?
@refp FWIW, that's normally considered 15/4 or (sometimes) 15p4.
It does not look like your code.
the i = ... was a left-over, sorry @JerryCoffin and @MooingDuck for the confusion. still trying to figure out why neither gcc or clang will let me catch the exception thrown by f(ii)
posted on April 10, 2013

People often use optimization to mean changing a program in ways that they think will make it run faster, but that casual definition is far from complete.

@R.MartinhoFernandes you got any educated guess in regards to my confusion?
whaa?
@MooingDuck compiler?
@refp Sorry, I honestly have no idea how function try-catch works. It's something I have always steered clear of.
22:46
@refp GCC something or other
@refp but your code is another story.
evening
@refp Hmm...interesting result. It is being caught, but then (apparently) re-thrown, at least with the version of gcc on IDE1.
Ell
Ell
22:48
I want to implement the ORB feature tracking algorithm
hey guys, what's your opinion on this? I was wondering wether a resource handle should have some sort of .destroy() method
an example would be a handle for a GUI window
@JerryCoffin coliru.stacked-crooked.com/… @MooingDuck @R.MartinhoFernandes
whoa, I think this is a bug in GCC
@JerryCoffin AFAIK those ctor try blocks don't stop propagation.
@MooingDuck it's not just gcc, clang does the same exact thing
22:49
@JerryCoffin What semantics would you want from stopping that exception? A ctor just failed.
coliru.stacked-crooked.com/… vs coliru.stacked-crooked.com/… only happens if it's the first member, catches if it's the second O.o
Ell
Ell
@night cracker put it in the dtor
You CANNOT stop propagation of those exceptions.
It makes no sense.
@R.MartinhoFernandes but the code you pasted from 15/4, doesn't it strongly imply that the exception should be handled in the ctor?
@R.MartinhoFernandes yes you can
22:49
@R.MartinhoFernandes of course it makes sense
What would you do with the nonexistent object after that?
@R.MartinhoFernandes nothing, it doesn't exist
it never existed
@R.MartinhoFernandes it's not non-existent.. what the?
@MooingDuck But the caller now has a variable "with it".
you're handling the object not existing, not the reason it threw an exception
22:50
@Ell obviously, but I could provide an additional destroy method. An example would be to more precisely dictate when the resource gets freed when using a stack variable
no, you are fixing the problem with creating the object by dealing with exceptions thrown when initializing it's members. the object is still there
Consider Jerry's code.
you are creating a house, there is a leak in the plumming, the house doesn't go away because of it
int main() {
    C c(1,2.0);
    g(c); // now what? c is not properly initialised
}
it's still there, and you can instead fix the plumming by.. hiring a slave to carry the water for you
22:51
@JerryCoffin I heard you guys got lots of snow.
@MooingDuck This certainly makes it look/sound like one of the two must be triggering a bug.
@R.MartinhoFernandes oh, that's just because he swallowed the exception. Obviously you don't want to swollow it
@MooingDuck So what is your confusion?
wait, guys.. what the heck is going on, what's the answer?
@R.MartinhoFernandes I thought you were complaining about constructors throwing exceptions. My bad.
22:52
what's wrong with this -> coliru.stacked-crooked.com/…, why is the exception rethrown?
@refp I think it's a bug in two compilers.
@refp wtf
@refp Because stopping it does not give any usable semantics.
@refp nope
It's not a bug anywhere.
@refp u can't stop an exception in a constructor
22:53
@EtiennedeMartel They threatened a lot, but we didn't really get much -- enough to cover the grass, but that's about it. It was pretty windy, and is back to snowing (a tiny bit) again now.
Ell
Ell
@nightcracker it would mean you'd have to check for multiple destroying. When would you need fine grained control?
It's by the book, and it's the right thing to do.
@sbabbi where is that stated?
This is why I steer clear from this crap: it's weird and dangerous.
@ell yes it does. That fine grained control is needed if you're watching for user input and want to close a window when he/she presses escape, for example
22:54
and the standard in it's example states that the code inside the catch should; handle exceptions thrown from the ctor-initializer and from the constructor statements, if the exception just keeps on flying by, how is that to "handle" anything?
@refp It undoes what needs undoing.
@refp if you are throwing from a member object constructor ( "i" in this case), that object "does not exists", so the only possible thing to do is throw from "Obj"
@refp In that code, what do you expect main to be able to do with x now?
It does not exist.
@R.MartinhoFernandes Look at @MooingDuck's pair of examples -- when initializing the first member throws, it gets re-thrown. When initializing the second member throws, it doesn't. I'll need to see a very specific quote from the standard to believe both of those are correct.
@R.MartinhoFernandes but where is this stated?
22:55
@R.MartinhoFernandes I have a feeling the number 1781 (housenumber of the Diner) in that short movie ought to have some special significance. But I can't put my finger on it
Rethrowing may be weird and unintuitive, but not rethrowing is just flat-out wrong.
Ell
Ell
@nightcracker well I would say hiding a window doesn't mean destroying the underlying resource. Have a hide() and show(). You don't want to have to construct a new window every time you open it I wouldn't think
@JerryCoffin K, lemme look at those.
let's skip the philosophy and actually talk in black and white, the object may or may not exists.. but where does it say that the exception should be rethrown?
@Ell well in this case it does
22:56
@JerryCoffin It's a bug in MooingDuck's code.
Fixed.
No exception is thrown if you don't call the throwing overload.
And now lemme get you guys a standard quote...
Sigh.
@R.MartinhoFernandes no wonder I couldn't reproduce it >.<
@R.MartinhoFernandes where is the bug in my code?
@refp there is no bug in your code, constructors can't swallow exceptions.
22:57
@R.MartinhoFernandes check 15.1/6 edited
@refp plumming? I have heard of plum trees
Still can't find anything saying re-throwing should be done, or that an exception in this type of code should be special at all. Going back to 15/4: "An exception thrown during the execution of the compound-statement or, for constructors and destructors, during the initialization or destruction, respectively, of the class’s subobjects, transfers control to a handler in a function-try-block in the same way as an exception thrown during the execution of a try-block transfers
control to other handlers."
(see full text)
@sehe plumbing
I have never looked at the standardese for these, but the semantics have been these since 98, so I doubt there's a bug in the standardese. But I will humour you.
@JerryCoffin agreed.
@R.MartinhoFernandes you won't find anything in the standard explicitly saying that it should happen (I kinda hope you do, but at the same time I'll be bummed if I overlooked it)

« first day (907 days earlier)      last day (4267 days later) »