« first day (776 days earlier)      last day (4172 days later) » 

2:00 AM
neat!
std::ifstream t("file.txt");
std::string str((std::istreambuf_iterator<char>(t)),
std::istreambuf_iterator<char>());
logical once I see it x)
 
Rather slow, though.
 
Hmm, how come? I'd imagine that would be fairly fast as it is a minimal set of operations.
 
But since you cannot rip out the guts of a stringstream, I am not sure I can provide a better option :(
@nixeagle It copies one char at a time.
 
oh good point
 
std::stringstream ss;
ss << t.rdbuf();
std::string result = std::move(ss).str();
// would be better, if you could rip out the guts of the stringstream by moving
 
2:04 AM
well wait, why would it have to copy just one at a time? Can't the implementation optimize things a bit?
auto vectorization and such
 
@nixeagle Well, it can. But I don't think any implementation does that.
@nixeagle That is harder to do if the iterators are not pointers to PODs.
 
ah, the iterator here is actually inhibiting that optimization :/
Hmm, I know gcc is pretty good at vectorization.
 
Such an implementation would need to have the string constructor look deep into the guts of the istreambuf_iterator and stuff.
I just want std::move(ss).str() to do the right thing. That would be good for many situations.
 
That would require unhandicapping move, no?
 
It's not an issue with move.
 
2:08 AM
I remmeber there were restrictions put on std::move in order to remain compatible with older code.
 
std::stringstream::str needs to have two overloads.
One lvalue-ref qualified, another rvalue-ref qualified.
The former works as currently. The latter grabs the internal buffer and sticks it right into the std::string without any copies.
No old code breaks because the latter would only be picked when the stringstream is a temporary, and in that case they cannot observe the change.
 
by the way I'm reading through this: stackprinter.com/… and I notice that quite a few of the tricks are preludes to the C++11 standard. I see static assert tricks, lexical cast, various pointer templates and so on.
 
That question is from 2009!
 
yea I know, but still interesting to see how the standard is going to make people's lives easier.
and @R.MartinhoFernandes ah I see, would require C++1y I guess.
 
@Xeo: hey, it's been two hours. Where are you? You said you would see me!
@nixeagle Yeah.
I am going to really call it day now :) Good night.
 
2:12 AM
night :)
 
'night
 
Knight!
 
Rook!
 
Knife.
Because talent.
 
2:18 AM
@StackedCrooked That half-human, half-orange hybrid?
 
@EtiennedeMartel Half human, half garbage.
 
@StackedCrooked I only know one of their songs: Heartbeats.
And even then, it's only because José Gonzalez covered it.
 
@EtiennedeMartel They have a couple a nice songs.
"Like a pen" is also good.
 
Ell
Damn I have homework -.-
Why didn't I remember earlier? -.-
 
@Ell Because you don't fancy doing your homework.
Dammit my room is trembling. This is not good at 3 AM.
 
Ell
2:24 AM
Resisting the urge to cheat on this homework is horrible!
 
Just fucking cheat then.
 
Ell
meh. Maybe I will
But I should use my powers responsibly!
 
Responsibly. I guess.
I discovered a cool anime.
It's called K.
 
Ell
K.
I'll check it out
 
@StackedCrooked Is it about an Ordinary High School Student?
 
2:30 AM
Dammit, now I read the ratings and it seems like it might not be that good after all.
@EtiennedeMartel OMG, how did you know!?? :D
 
Ell
I don't watch anime o.O
 
@StackedCrooked I like checking stuff on my Overused Trope List when reading a synopsis.
Speaking of single letters, I guess you guys should watch C.
 
@EtiennedeMartel That tropes link refers to Kenichi‌​, which is a fantastic series!
I really enjoyed that one.
 
Ell
How are there so many animes?
 
@Ell Because it prints money.
 
Ell
2:32 AM
Are they in high demand? or are they quicker to produce?
It does? Even though you can stream them for free?
 
Animation is cheaper than live action.
@Ell Geez, I wonder how YouTube can stay afloat then.
 
Ell
But I mean, its not the producers that get ad revenue is it?
Unless they are intentionally free to stream, which I assumed wasn't true
 
They're not. They air in Japan, that's all.
People outside of Japan typically aren't part of the target demographic.
Still, Funimation essentially dubs and subs a lot of animes, and it seems to be doing a decent amount of money.
 
Ell
for a country as small as Japan, Its just a heck of a lot of animes
 
Not that small.
 
Ell
2:35 AM
Just quite suprising Imho
 
And, as I said, animation is cheaper than live action.
 
@Ell bigger than it looks on a map, and quite high population for its size.
 
And the main reason why we don't do lots of animation in the West is mostly an ideological one: for most people, animation is for kids.
 
Ell
Yeah. I don't understand that either, How can drawing so many frames be cheaper? I guess they don't draw the entire frame again
 
The huge majority of animation for adults is satire (usually vulgar).
@Ell Computer generated now.
 
Ell
2:37 AM
like, 2d anime style is computer gen?
I have spoken to a real animator, used to work for disney. Worked on fantasia and some other stuff
 
Not entirely, but animation is no longer done "by hand" on celluloid.
 
Ell
very interesting, and he did have to draw a lot of stuff
I also find it weird that it is a photo of a drawing
 
That's how it was done before.
 
Ell
Yeah, I find it amazing
Ughhh ducks sake I really can't be bothered with this maths!
 
You have to use your brains and be diligent!
 
Ell
2:49 AM
And now my foot has randomly started painfully throbbing
 
@EtiennedeMartel You can say that again. Some people brought their kids to see "Ghost in the Shell" movie in theaters and then gave it a shit score online because their kids didn't like it. NO SHIT
 
3:05 AM
Poor kids :(
 
Finally making progress on my assignment
can't wait to be done...
 
Any have any experience with hacking Aero into Win8?
I can't live without the transparency.
Heck, I wish Windows could actually do the Emerald effects in Linux.
 
3:45 AM
Anyone willing to help me reopen the lambda question?
 
Not enough rep :(
 
The question itself is a valid question. But sehe hated it so much that he wanted to kill it.
 
3:58 AM
@Mysticial Link?
 
12
Q: How is "int main(){(([](){})());}" valid C++?

MysticialI recently came across the following esoteric piece of code. int main(){(([](){})());} Reformat it as follows to make it more readable: int main(){ (([](){})()); // Um... what?!?! } But I can't get my head around how (([](){})()) is valid code. It doesn't look like function pointer...

If anything, it's the wrong close reason.
 
I'm sure it has been mentioned already, but you can add some pluses to that expression.
 
Damn, that review queue is fast...
@LucDanton I didn't wanna make it too ridiculous. So I kept the original one that sehe first posed.
 
@Mysticial, I gave something like that to the class I'm helping with as a bonus :p
 
Since that original one was the one that I tried for at least 10 minutes to figure before I asked in chat.
@chris Brutal. :)
 
4:09 AM
Well, actually it was a bit more brutal than that. I used digraphs about half the time I could to mismatch stuff.
 
<:bitand:>(){}()
 
@chris oh geez...
 
And I had two output statements in there, but only one lambda was called, so only one was outputted.
Actually, it's on my flash drive. Sec
#include <iostream>
int main(){<:](){std::cout<<"Hello";;%>;[:><%std::cout<<"Hello";;}();}
 
@chris ow... :)
 
@Pubby, Hmm, didn't think of using bitand. It actually works well like that.
I'm looking forward to having to explain this.
 
4:14 AM
@chris If you use bitand= you won't run into &= problem.
 
@Pubby, Interesting point.
 
Therefore, you should always use bitand
 
Must... get... Aero... to... work... on... Windows 8.
 
@chris Needs more jQuery Trigraphs.
 
Can't live without my eye-candy.
 
4:15 AM
@JerryCoffin, Those caused warnings in GCC. Apparently MSVC doesn't even like digraphs.
Shoot, I just realized the test I provided was a link to LWS. Maybe I should change that and tell them.
 
@chris At least if memory serves, VC++ does handle trigraphs though.
@chris It might be a bit more of a test of endurance than skill the way it is.
 
@JerryCoffin, Yeah, I was planning to give seemingly unrelated hints.
As in not say it's related to the bonus, but if they listen and then look at the bonus afterward, might be able to see something new.
On the plus side, it's completely not searchable.
So is stacked-crooked.com stable? And what version of GCC does it use?
Wait, scratch that. The example program has the version... Duh
I have to say, online editors are getting pretty good.
 
I think online IDE would make learning C++ a lot easier
 
@Pubby At least makes it easy to get away from all the nonsense of initial installation.
 
4:30 AM
Setting up C++ is nowhere near as bad as PHP imo.
 
Dammit... all these Aero hack tools suck.
 
I'm kind of glad I didn't try Windows 8.
 
@chris Of course -- everything about PHP is worse (than anything else).
 
I do like Aero, though. This was fun to play with.
 
Well, I haven't moved over to it yet. It's a new machine, so I'm trying all sorts of things on it.
 
4:35 AM
@chris I've done some testing with it for work -- can't say it impressed me much, but I didn't use it for very long either.
 
@JerryCoffin, Yet it seems very widely popular with people wanting work for their site done.
 
@chris Nobody wants to be caught out in case the Slab (or whatever stupid name MS is using) happens to catch on.
 
5:01 AM
That's the problem when you don't have any competitors. You can remove popular things with impunity.
I give up... all I find are transparency hacks. I'd be fine with them if they didn't drag around residues.
There appears to be some guy in China who's trying to hack the Aero .dlls into Win8.
"I don't know what this error message is, but it must be important, so I'm going to bold it in my question without actually reading it." And this is why we'd rather block such submissions. — BoltClock's a Unicorn 8 mins ago
 
@Mysticial Anything that starts with "That's the problem when you don't have any competitors" is automatically wrong -- almost inevitably, lot of problems arise when you lack competitors. In Microsoft's case it's worse than usual though, because it's also about the most badly managed company on the planet. "Management by throwing chairs" may be a sub-optimal strategy.
 
haha
so true...
 
5:19 AM
@Mysticial I'm guessing this was submitted by a kindergartner who automatically interprets "don't" as "yes, go ahead and do that". :-)
 
5:31 AM
DONE
My assignment is done
And this is prob the last time I do REST in my entire life.
 
@Borgleader Congratulations!
 
I have to mention I wasted 2 hours because part of the code provided to us had bugs in it
 
That guy Eric Lippert is leaving microsoft
 
-.-;
@Rapptz Repost
 
Your face is a repost.
How do you feel about that Borgleader?
 
5:38 AM
7 hours ago, by Cicada
Eric Lippert is leaving Microsoft? HELL BREAKS LOSE
 
Anyway I only brought it up because I found his SO account
and this guy has only upvoted 1 thing
but downvoted 345 things
 
@Rapptz That's actually funny.
@JerryCoffin Have you ever worked with REST?
 
He admitted that the upvote was a misclick.
 
Wow he is not very rewarding is he
 
5:40 AM
Why not "un-upvote" it?
 
He does have a lot of favorites though.
 
5 minute window
 
Oh...
 
Though you're right, it is weird that it's a misclick.
 
To some extent, I count favoriting as an upvote of some sort.
Unless you're favoriting obvious troll or bad posts because they're funny.
 
5:41 AM
@Borgleader Not enough to care about, no.
 
I have 26 favourites.
 
A lot of my favorites are troll or hilariously bad posts with high entertainment value.
Most are deleted though.
 
Most of the stuff I'd favorite get deleted, and then I can't read them :(
 
@Pubby because it just was
 
5:43 AM
@Pubby I'm surprised that one went down so fast.
 
@Pubby I guess it's because "call this pointer" doesn't mean anything.
 
Usually these "Is A faster than B?" questions that provide no evidence take many views and hours to close - and then they go through multiple close-reopen cycles. (if they get enough attention)
 
user406009
@Borgleader I think he is asking if a member function's use of the "this" pointer adds overhead.
 
@Borgleader template<typename T> using T* = call_this_pointer
 
user406009
Just guessing because his member and free functions have the same name, so he might be trying to compare their performance.
 
5:45 AM
Interesting... Eric Lippert favorited the denormal float question...
I bet he might've been bookmarking it to possibly put some denormal control handling into C#.
 
@Borgleader No, but anybody qualified to express an opinion on the subject is perfectly capable of understanding what he means -- voting to close a question that's clear just because it's not perfectly expressed is much worse than asking such a question. If that's really a concern, they should have edited rather than voting to close.
 
@JerryCoffin True. I'm not defending, I'm merely trying to explain
In the end though the perf difference should be ~nil.
to my knowledge
 
@Borgleader Yeah, I kinda figured -- just adding my two cents worth, not trying to argue with you, or anything like that.
 
I don't actually understand that question. Anyone care to clarify?
 
@Borgleader Probably -- but nothing at all wrong with an objective test proving it.
 
5:49 AM
Don't understand = NARQ. "Not constructive" would be the wrong close reason.
 
@Mysticial "Does passing the this pointer add overhead to a member function call versus a non-member function call?"
 
@JerryCoffin Ah, I see.
 
I think he's asking if the the this pointer makes it slower
 
It is probably less overhead than it would be in C due to "thiscall" or whatever it's called
 
It certainly can make it slower. Just by how much...
 
5:51 AM
Are you guys reopening it?
 
@Pubby At least if you're using a compiler that uses thiscall (i.e., Microsoft).
 
I wish I could do "reopen flags"
 
I don't know why you should be concerned with the overhead of passing a pointer
 
@Rapptz It only needs 1 more reopen vote anyways.
 
Especially since there's not really any other way to do it
 
5:52 AM
@Mysticial yeah but I like it when it counts toward my flag count
 
And nobody from the review queue has looked at it yet.
 
@Mysticial The better question would probably be "versus what"? If the function needs access to members of the struct/class, then a non-member will still need to receive a pointer/reference to it. If it doesn't deal with members, then there's probably no reason for it to be a (non-static) member function at all.
 
@JerryCoffin Yeah. It would be hard to properly benchmark it.
The OP just clarified it.
 
@JerryCoffin That's probably why it was closed as non-constructive. You cannot answer the question properly because we don't know what the function is supposed to do. It's also pre-emptive optimization. For something that doesn't need access to internal members the difference seems to be an additional lea.
 
Now I understand I'd have understood it without Jerry translating.
 
5:57 AM
Does the compiler even add a this pointer if it's not used in the member function?
 
Maybe not in Release. I compiled Debug.
 
@Pubby It might as well inline it.
 
I suppose it would in libraries or whatever
 
It would depend on where it's called.
 
Can I paste like 10 lines of ASM? or nobody cares?
 
user406009
5:59 AM
Couldn't he just make the function static and avoid the whole this pointer issue altogether?
 
@Borgleader you sick bastard.
my monitor will implode
 
From what I've seen, if a function is not extern and is only called in one place, then VS2010 will actually optimize the calling interface. (remove unused parameters and such)
 
@Rapptz Its the disassembly from the code I wrote. I didnt write it by hand.
 

« first day (776 days earlier)      last day (4172 days later) »