« first day (271 days earlier)      last day (4683 days later) » 

12:08 AM
Hm, the predicate should be allowed to be a function, but we can demand that the user wrap her predicate in std::function. So that should be template<typename...> class Op in there.
We also need to assume that both the future and the operation expose their return value
 
Mandating std::function for functions is a huge loss.
 
I'm not, I'm mandating template<typename...> class Op :-) Just saying that if you do have a function, you can use it and wrap it in std::function
Do you have a future somewhere I can test?
 
Do you mean std::future? I'm not sure I follow you.
Also, it's bedtime for me.
 
Well, some sort of suitable object to feed into the lazy evaluator.
Yeah, same here acutally
Let's earmark this for another day ;-)
 
 
1 hour later…
2:13 AM
Are you sure this isn't undefined behaviour?
I mean, is there a special allowance for char members of a union?
 
 
2 hours later…
3:48 AM
@KerrekSB Yes. You're allowed to access other types as a sequence of char or unsigned char with relative impunity.
 
 
4 hours later…
 
1 hour later…
8:52 AM
Morning
 
Morning.
@jalf That is so stupid.
 
morning
 
9:19 AM
@MartinhoFernandes You've misspelled awesome.
 
I don't see how walking around with a pasta strainer on your head is so awesome. It just looks silly.
 
Kinda like you look silly with a tinfoil hat.
 
What an intolerant thing to say!
 
9:24 AM
he doesn't. he just did that for the photo.
 
Stop oppressing him!
 
Hello
 
Guys i wonder if you know any web with explaination about longest common subsequence, but in O(n log n) time, not n^2 ?:)
 
Wikipedia?
 
9:28 AM
I too seem to remember an okay article on Wikipedia.
 
@MartinhoFernandes I'd say that's the point.
 
Oh, thanks :)
Didn't even try to search on wikipedia, because in my country it isn't good source of knowlegde
thanks ;)
 
Use the English version.
 
Ah, debugging AJAX-loaded HTML that breaks the page.
Wonders of technology.
 
Bad browser?
 
9:34 AM
Yes, Opera.
 
Aww, on wikipedia too, no algorithm in n log n, only a little faster n^2
 
Oh, nice, now it breaks even more.
Awesome.
 
change for IE :D
 
@Chris You're sure it can be done in n log n?
Isn't it NP-complete or something?
 
it is n^2 in dynamic programming
 
9:42 AM
Oh, for only two sequences?
 
yes
 
@Chris I-whatnow?
 
-shitE
:D
 
But you can't do it better than polynomial.
 
I don't know any browser named like that.
 
9:44 AM
I wonder if it can be done in linear time using suffix trees
but i cant code suffix trees, but lol
@Cat
maybe firefox?
 
In mathematics, a subsequence is a sequence that can be derived from another sequence by deleting some elements without changing the order of the remaining elements. For example, ABD is a subsequence of ABCDEF. Formally, suppose that X is a set and that (ak)k ∈ K is a sequence in X, where K = {1, 2, 3, ..., n} if (ak) is a finite sequence and K = N if (ak) is an infinite sequence. Then, a subsequence of (ak) is a sequence of the form (a_{n_r}) where (nr) is a strictly increasing sequence in the index set K. Example As an example, : \langle...
Are you sure you're not confusing a subsequence with a substring?
 
I'm sure :)
 
Firebug currently crashes it for some reason.
 
i know we can find substring with suffix tree, just stupid thought :)
 
So it's Opera for development.
 
Aaaaargh, I fix one thing and three others break.
 
O(N lg N + D^2), where D is the length of the shortest edit script.
 
Serves me right for quick deployments, I guess.
People gonna be angry.
 
Hmm interesting pdf
Im trying to solve https://www.spoj.pl/problems/MAXMATCH/ this problem
i came up with that we have to find LCS of original string with original string minus first character
And thats why im trying to find n ln n algorithm ;)
 
Huh, why wouldn't a linear solution work?
 
9:54 AM
Does exist it ?
 
Oh wait, that would not be linear.
I need coffee.
 
;)
 
And btw, did you try submitting the quadratic solution?
Just to make sure it's not enough :)
0
Q: How to pass by lambda in C++0x?

ClintonIt seems the way to construct objects in C++0x avoiding copies/moves (particularly for large stack allocated objects) is "pass by lambda". See the following code: #include <iostream> #define LAMBDA(x) [&] { return x; } class A { public: A() {}; A(const A&) { std::cout <&l...

Pass by lambda? Is this guy making this up or is this something real?
 
yes, quadratic one TLE's
oh, don't know a lot about new standard in C++0x
 
@MartinhoFernandes There is such a thing as call by need.
 
10:01 AM
What is that?
 
A common implementation (or so I'm told) is that instead of passing parameters
a trampoline/thunk is passed and if the callee needs the argument then it's used to obtain the actual parameter.
It's a strategy to have lazy behaviour.
 
@LucDanton you talking about call by name?
 
@ÓlafurWaage I don't think it's quite the same although this one also can also use a similar implementation
Or maybe call by need is implied with call by name.
I think that's a better description of the relationship between the two.
 
Hmm could be. Some of these evaluation strategies can be scary.
 
Hmm, I understand passing lambdas to get laziness.
But there's no laziness in that question. The lambda gets called in the initialization list.
 
10:05 AM
I'm reading it atm, but it's the first thing that came to mind from the title.
It's call by need in the initialization list I'd say.
This guy is obsessed with copy-elision and the like.
 
I got that.
I've been there.
But I'm okay now :)
 
Yeah but, were you obsessed with eliding move construction?
 
No! Just copies.
 
This guy wants to avoid anything, he needs in place construction.
 
:)
 
10:09 AM
> Great things come out of abusing C++.
 
No more automated error messages. Weee.
I could use code reviews and a reasonable deployment strategy.
 
@CatPlusPlus what are those?
 
Amen!
 
@TonyTheTiger Django instances mail admins the traceback when uncaught exception is thrown.
Really, any webapp should do that when it shows error 500 to the user.
 
@CatPlusPlus oh ok
didn't know you did web dev?
 
10:12 AM
I think our 500 page was broken, too, and it double faulted lol.
I did somewhat. Now I'm getting paid.
 
anyone ever played with boost::proto?
 
@TonyTheTiger Quite some time ago I did.
 
The researcher sitting in front of me arrived for the 3rd day in a row with home baked cookies she made herself.
 
Cookies are good. Unless they expire in 2111.
 
10:23 AM
Hm, libclang. Maybe I'll finally get that automated Python wrapper generator done.
 
10:40 AM
@LucDanton did you find it hard?
 
@TonyTheTiger Yes.
Following the manual is Okay.
 
Taking the jump from Hello World! to my own plans was not easy.
 
surely
 
If you could mix any two languages together. What languages would that be and which parts would you mix?
 
10:44 AM
There are at least 2 ways to use Proto though. It seemed like a used the hardest of the two. I'll look up the docs.
 
@ÓlafurWaage Haskell and C++!
Or maybe not.
 
@ÓlafurWaage The nice & powerful bits of C++ with the syntactical convenience of a functional language.
 
@LucDanton Exactly!
 
I had to write expr ? expr : fallback; yesterday, I hate that.
@TonyTheTiger Sorry, I can't remember what I did wrong.
 
Having pattern matching in C++ would be nice.
 
10:48 AM
I want to write (expr ? a : b) = (otherexpr ? value : othervalue); just to mess with someone.
 
You kinda have it in templates.
 
Though knowing the tendencies of C++ syntax, it'd be some obscure, arcane incantation of dark magic.
 
@ÓlafurWaage You can, can't you? It's only a problem when one of a or b is not an lvalue.
 
(rand() ? a : b) = (rand() ? a : b)
 
10:50 AM
rand() is poor.
 
I know. It fits.
 
@LucDanton I can, I just don't.
 
@ÓlafurWaage that's evil. I love it
 
(rand() % 2 ? a : b) = (rand() % 2 ? a : b)
Isn't that more fitting?
 
Not very random, is it.
 
10:56 AM
You need a boolean expression there, so a random between 0 and 1
 
Yes. That's a random between 0 and 1.
Not a very expensive noop.
 
Every integer divides by 1.
 
Now you just made me look silly.
 
You are a fine gentleman.
 
10:58 AM
Loud noises.
 
Today's task. Get @CatPlusPlus to cover the star board.
 
... in blood!
 
With an asynchronously loaded knife! please wait...
Debugging this is so much fun.
 
I was quite pleased to learn Boost.Asio can ouput some logging and provides a script to generate graphs from it.
Not that I tried it but I was always afraid of debugging Asio code.
 
11:02 AM
Well, reactors are scary.
 
I'm working on a pretty large codebase this summer. A codebase I'm still trying to learn how works properly. I've been writing a mapper between two systems we are using and having to use a lot of the utility functions within our system.
The version that uses the mapper was considerably slower than without it.
 
Is there a question somewhere? Or a lesson to be learned?
 
So yesterday I started to profile the code and trying to figure out why. I found a constructor that was taking too much time but within in it was just newing two utility functions. Then it dawned on me. Those utility functions load huge XML files, and that constructor is called A LOT.
 
Now that I think about it, Boost.Asio has provided the hooks to do this kind of functionality for quite some time. I guess someone provided their extension for everyone else.
 
11:05 AM
Let's just say that I improved the speed of the system by 80x
 
Woo, I made it work.
 
A large test run that took about 80 minutes to run takes 1 minute and 11 seconds now.
 
Why is it that "huge" and "XML" always seem to show up together?
 
And then it stopped.
 
Originally this class was not meant to run in a tight loop so newing those classes was just fine, but the design changed but the underlying code did not.
 
11:08 AM
@MartinhoFernandes aren't they synonyms?
 
Niiice, it works exactly once, and then it stops.
I've invented a singleton AJAX request.
Somehow.
 
Singleton AJAX requests are considered harmful.
 
Oh, it gets funnier. It does the request, but the response vanishes somewhere.
I think the function that is supposed to load crap into an element replaces it with a new one.
 
You need a singleton AJAX response.
 
Good grief.
 
11:15 AM
That's some skynet shit you've got there.
 
This makes no fucking sense at all.
 
Welcome to the modern world.
 
@JerryCoffin So, to be clear, if I have union { unsigned char[sizeof(int)]; int };, then it is explicitly well-defined to write to one field and write to the other?
 
Finally. Inserting a temporary div into the destination and loading into that works.
 
hello C++mates
 
11:27 AM
Hi.
 
@KerrekSB I'm not Jerry but no, it is not. It is, however, often done (relying on the implementation).
 
I'm looking for a real, standard-compliant answer. So you're saying that union access is never well-defined out of order?
So the only fully standard-compliant way to access a type's binary representation is casting to char*?
 
You can only read what you last wrote to.
 
That's what I thought. It's just that people keep proposing casts-through-union as a way to access the binary data of an object.
 
11:33 AM
@KerrekSB probably because common compilers explicitly guarantee that it'll work
even though it's UB
 
I always thought the only valid way is to cast to char* and iterate over sizeof(X) bytes.
 
I believe @Xaade calls it horrible_cast.
 
Hehe. Nice.
OK, cool, thanks.
 
@KerrekSB Indeedy.
 
The "this is the best way" comment troubled me.

http://stackoverflow.com/questions/6687467/converting-char-array-to-long-in-c/6687559#6687559
 
11:46 AM
so that is UB in C?
I am pretty sure GCC guarantees me that, because i've been using it for years
and I always thought that union members were just ways of seeying the same memory region.
 
> From the C99 standard (ISO/IEC 9899:TC2, WG14/N1124 Committee Draft — May 6, 2005), Annex J (informative): "The following are unspecified: ... The value of a union member other than the last one stored into (6.2.6.1)."
 
@hexa in practice they are, in theory it's not guaranteed
 
what is the theory behind that?
 
@hexa nothing, other than that it's fundamentally an abuse of unions ;)
so the standard doesn't guarantee that it'll work
 
11:52 AM
@hexa although consider all the usual aliasing issues. if I write to one member of a union, then if the compiler has to assume that it will alias other members of the union, then it has to disable useful optimizations. So not making that guarantee allows the compiler to optimize more aggressively
even if it doesn't actually do so in practice, as @MartinhoFernandes's link says
 
I also think MSVC guarantees you that
 
The language is inherently about values, not about representations, which is why the union doesn't have defined behaviour under out-of-order access -- it's simply a type "big enough" to hold any member. On the other hand, the algebraic conversion between integral types of different widths that I wrote only refers to values, so it's deterministic.
 
Hmm, why should I produce DLL's with /SAFESEH (msdn.microsoft.com/en-us/library/9a89h429(v=VS.100).aspx) linker flag? What good is it for?
 
I've seen windows code using this type of thing, I can recall by heart unions with the header of bitmaps
 
@hexa yep, it does
 
11:59 AM
Ooh, one upboat left for bronze (what the fuck was my brain thinking) .
 
Great. JavaScript, the language of the World Wide Web does not support Unicode in regexes.
 
That's a surprise? :P
 
@KerrekSB you are completely right, but that is officially supported by gcc and msvc, probably llvm too and many others. do you still think this is not a valid solution?
 
It's ugly regardless of whether it works.
 
@CatPlusPlus It gets better. \w and \d are ASCII word characters and ASCII digits. \s is Unicode whitespace.
 
12:03 PM
uglier than 4 or more shifts and or's?
 
At least it could be consistent.
 
@MartinhoFernandes Riight.
The day JavaScript is consistent is the day the Skynet takes over.
 
I don't believe that. I think Skynet is a runaway Perl interpreter.
 
@hexa Yup.
 
@hexa It's just an inelegant solution that departs from the idiom of the language, so I'd consider it "bad style".
 
12:06 PM
I disagree. I think it is very elegant.
And fast.
 
It departs from the idiom of a value-oriented language.
 
It's not explicit and relies on a right implementation to work correctly, what's elegant about that?
 
Every implementation I know of supports this
 
Plus, it hides the endianness, which my solution forces you to acknowledge.
 
how explicit shifts acknowledge endianess?
 
12:08 PM
If you want a string of bytes, you better know in which order they come.
Shifts have nothing to do with endianness.
 
oh really?
 
Yeah, now. They're also free to stop supporting this at any moment.
 
explain to me better this shifts have nothing to do with endianness statement, I am really eager to listen
 
It's a classic example of where doing things idiomatically forces you to do it right. When you get your input byte string, you cannot make sense of it without knowing its ordering. When you choose the conversion function, you have to make a choice, which reminds you that this information needs to be provided along with your bytestream
 
12:10 PM
Shift works on values, not representations.
 
35 open bugs left.
 
I did not know that @KerrekSB. Nice one
I always thought 0x1234 >> 8 would give me 0x12, always
 
Well, it does, because that's just a statement about values.
 
I expressed me wrong.
 
Check out my answer again, you will see that everything I say is entirely in terms of values, never of representations. I could even have said + instead of | to make this more obvious.
left shift on integers is multiplication by 2, right shift on unsigned integers is truncated division by 2. That's always true.
OK, prize question: Does anyone know a method to serialize a float to a byte stream without using any sort of type punning, so that deserializing results in == for non-NaNs?
 
12:23 PM
@KerrekSB Does stream.write((char*)&f, sizeof f); count as type punning?
It's an allowed cast after all.
 
It's an allowed cast, but it's still type punning.
(As opposed to an invalid cast, which is UB.)
See, if you have an integer serialized as bytes, you can just do algebraic manipulations to reconstruct the integer. That'd be pun-free.
But for floats, I see no such solution.
 
I disagree that reading the bytes of an object if a form of type punning.
 
Hmm. Let me see what GCC says :-)
 
But if you want to only manipulate floating point data, there is a precision you can use to make sure the representation survives a round-trip.
There was a somewhat recent clc++ discussion about this IIRC.
 
it is an allowed form of type punning
char is allowed to alias anything
and to read anything from memory
 
12:33 PM
@KerrekSB Unrelated but do you have access to GCC 4.6?
 
All hail char!
 
I tried to coerce the GCC 4.5 from Ideone to work but I can't stand it anymore.
 
@JohannesSchaublitb Allowed, yes, but also allowed with strict aliasing?
Hm, now in GCC 4.6.1 I have trouble provoking any aliasing warning (at -O3)...
 
i was talking in terms of strict aliasing
 
@KerrekSB There is an exception for pointer to char types.
 
12:34 PM
OK
Yes
 
char can alias anything. and signed T can alias unsigned T
 
I see. Nice. I suppose that's necessary, because you do need byte streams to interface with the environment.
 
The C++ Standard doesn't have optional features (other than the library(?) changes between freestanding or not).
So, about that GCC 4.6?
> Internal compiler error: Error reporting routines re-entered.
Fuck 4.5! Out with the old!
 
Hehehe. ICEs yay.
 
@KerrekSB 4.6, do you has it?
 
12:38 PM
I has 4.6.1
How weird: I'm trying this example, but I cannot get the compiler to warn!
I have all options on: -O3 -Wstrict-aliasing -fstrict-aliasing...
 
There are varying warning levels for strict aliasing, to avoid false positives.
Not sure which one and how to tweak it.
-Wstrict-aliasing=3 or something. Check the docs.
 
@LucDanton tried with 4.6.1? That fixed the errors I got from 4.6.0 at least
 
what that page says.. "Each definition of a static inline function must be identical." .. I think that is BS
C99 has no such rule by what I know
the statement doesn't even make any sense
a static inline function can only be defined once
 
@jalf I'm trying right now.
 
so "each definition" can only refer to one definition, and that definition is by definition identical to itself
 
12:42 PM
@JohannesSchaublitb C99 and C++ differed for that one.
 
But different TUs all see their own copy
 
And C99 does have extern inline, it's horrible
 
If you change the header file between compilations...
 
where there is one and only one canonical definition of an inline function.
 
@LucDanton that doesn't seem to be related to my rage, but I agree
 
12:43 PM
I guess it's not a clause that you'd ever practically risk violating
 
3
A: Multiple definition of inline functions when linking static libs

Johannes Schaub - litbFirst you have to understand the C99 inline model - perhaps there is something wrong with your headers. There are two kind of definitions for inline functions with external (non-static) linkage External definition This definition of a function can only appear once in the whole program, in a des...

that's the one and only one "external definition"
 
@JohannesSchaublitb Well he does mention C99
 
@LucDanton but he says something totally nonsensical
"Each definition of a static inline function must be identical."
that's all wrong
 
Is it? No ODR in the C world.
I think it's muddled though.
 
yes no ODR. so "must be identical" should be "can be different"
but the "Each definition of a static inline function" is in itself illogical
 
12:45 PM
"can't"?
 
because each definition that is included multiple times defines a different function.
so each static inline function only has one definition
 
Well it is weirdly phrased.
 
it's completely wrong. not a phrasing issue. I will send a mail to that guy
 
oh right, I see what you're getting at
yeah, that seems nonsensical
 
$ ./make.sh 2>&1 | wc
     27     380    4815
At least it doesn't ICE
Anyone knows why uniform initialization failed yet again at line 62 : functor { std::move(f) }?
 
12:56 PM
@MartinhoFernandes I had deleted it because I have never tried the parenthesis in C++, and was not sure if it was an alternate way I had not heard of.
 
@LucDanton Very generic -- nice!
 

« first day (271 days earlier)      last day (4683 days later) »