« first day (419 days earlier)      last day (4544 days later) » 

8:00 PM
@Ell its built-in tetris game is about the only thing that works. Everything else is slow and unresponsive, not to mention feature lacking
 
Ell
well i've only ever used code::blocks
 
I wish there was an ide like vim except not ancient
 
Ell
oops
i just did
git branch help
how do i undo? :/
nevermind
did it
 
Ell
git branch -d help
 
Xeo
8:05 PM
41
Q: What kind of jobs did programmers do before programming existed?

AlisonWhat kind of jobs did programmers do before programming existed? Were there a lot of dissatisfied bureaucrats, farmhands and hawkers with a terrible itch to change career, but never sure quite what to change to?

 
Ell
:D
 
Xeo
> Electronic engineers, and before that mechanical engineers and before that blacksmiths. Which explains why most of us have a deep genetic urge to take a large hammer to a computer occasionally.
 
Haha.
 
Hi all
Whats up
 
Ell
hi
 
Xeo
8:07 PM
@StackedCrooked whut?
 
Perhaps Kobato is not the only anime that features Baumkuchen.
 
I actually assumed various engineering jobs/accountants
 
Woa, those came out of order.
 
Xeo
@StackedCrooked Oh, you were referring to that. No, that's not what I meant :)
 
@Xeo I always thought I'd be into clockwork if I was born before computers existed.
 
Ell
8:12 PM
i would just invent a computer :)
 
Xeo
@StackedCrooked I'd be interested in time travel - it looked much more reasonable at that time then it does now! :(
 
computer used to refer to people who did computations
I'd probably be a computer
 
@Pubby I suck at computing.
 
user457812
I'd have probably been the village idiot.
 
@StackedCrooked at least you can pass the turing test
 
8:15 PM
I might even fail at that.
 
**binary file formatted in hex**
????
markdown broke?
 
Xeo
multiline non-markdown 1 : 0 Pubby
It's always like that
markdown breaks on multiline messages
 
but I want to write
stylish multi-
line messages
:(
 
`It sucks.`
Really.
 
I hate specifications like that. I saw one the other day. cplus.about.com/od/programmingchallenges/a/… Take a text file of bits. This represents International Morse Code encoded into binary with a 1 representing a dot, a 0 representing the pause between dots and dashes, and a dash is 111. The space between two letters in a word is 000 and between two words is 0000000. Turns out it was '1' chars and '0' chars.
I had to write an "translator" but luckily that's easy
 
Ell
8:19 PM
ugghh having trouble with unique_ptr now o.o
 
@MooingDuck I once posted a solution to one of his quiz questions.
 
Ell
how can i dereference a unique_ptr to return a reference?
 
@MooingDuck I don't know much about morse code, is three dots distinguishably different from a dash?
 
Ell
the dereference operator makes the compiler complain
 
@Ell: *ptr shouldn't make it complain.
 
Ell
8:21 PM
hmmm
 
@MooingDuck The WP page makes it look like you can have 3 dots followed by a dash. What's 111111?
 
Ell
it does :/
 
Two dashes, 6 dots, or one dash and 3 dots?
 
Ell
wait sorry
i forgot to delete the * in the template defenition
 
@Robjb: a dash is a tone three times as long as a dot. 1 represents a dot, 111 represents a dash. 111111 isn't anything.
@Robjb: dots and dashes are seperated by a lack of tone (0)
 
8:22 PM
@MooingDuck Ohh, okay then.
 
@robjb: A is dot-dash, so 101110
 
Looking at your specification again, I missed that 0 was the separator
 
Ell
nevermind :)
 
Xeo
> How much could it be simple by C++ boost for such string parsing?
wtf?
 
@Ell: glad you got it, I was stumped
 
Ell
8:26 PM
:)
but now i have another problem
no match for operator= in .....blahblahblah
 
Xeo
1 min ago, by Xeo
> How much could it be simple by C++ boost for such string parsing?
 
Ell
hmm
mNodes[key] = mAllocator.allocate(1);
errors
 
Xeo
@FredOverflow Before you leave, upvote my comment on the question :P
 
@Xeo I don't understand the comment ;)
 
Xeo
That's the plan :D
 
8:30 PM
@Ell: you can't assign a pointer to a unique_ptr directly, you have to be explicit.
mNodes[key] = std::unique_ptr<Node>(mAllocator.allocate(1));
 
Ell
but wont that go out of scope?
and then destruct the node?
 
Only after it "gives" the Node to the map.
 
Xeo
@MooingDuck That won't work either afaik, you need a std::move there.
 
Ell
at the end of the function?
i was thinking that
so how exactly do i use std::move ?
and how do i put stuff in monospace?
 
@Ell: you make a unique_ptr that owns a object. Then comes the assignment. The assignment takes the object from the first pointer, so that the temporary no longer contains a node. Then the temporary goes out of scope, and deletes nothing
@Eli: backticks for code
 
Ell
8:32 PM
backticks?
okay ta
 
@Eli: mNodes[key] = std::move(std::unique_ptr<Node>(mAllocator.allocate(1)));
 
Ell
and thankyou :)
 
you move the pointer from one to the other
 
Ell
fyi its Ell for elliot (male) :) lots of people misread that :P
thankyou very much
and har har! it compiles!
 
@Ell: sorry, I know a guy named Eli.
 
Ell
8:35 PM
no problem it seems to happen everwhere on the internet :)
hmm how on earth does std::move work?
 
How do I do a manual rep recalc?
 
Xeo
scroll to the bottom
 
@Ell: It returns the parameter as a temporary, an rvalue.
 
sweet, I gained 20 after recalc
 
Ell
and the rvalue gets moved?
 
8:39 PM
damn, I just lost ~60
 
std::move is just a nicely-disguised cast to an xvalue. Nothing gets actually moved by std::move. It just enables moving on something that would otherwise not be allowed to move from.
 
Ell
xvalue?
 
@Ell: know how a vector contains copies of all it's element? Making a copy of a vector is slow, because it has to copy the entire thing. But if you assign a temporary (rvalue) vector to a named (lvalue) vector, the named vector can simply take the internal array of the temporary, and the temporary will own nothing. It's way faster.
 
Ell
o.O
 
13
Q: Real life examples of xvalues, glvalues, and prvalues?

user411102I was wondering if anyone could tell or explain some real life examples of xvalues, glvalues, and prvalues?. I have read a similar question : What are rvalues, lvalues, xvalues, glvalues, and prvalues? but I did not understand what everyone meant. Can anyone explain in what cases these values a...

115
Q: What are rvalues, lvalues, xvalues, glvalues, and prvalues?

James McNellisIn C++03, an expression is either an rvalue or an lvalue. In C++0x, an expression can be an: rvalue lvalue xvalue glvalue prvalue Two categories have become five categories. What are these new categories of expressions? How do these new categories relate to the existing rvalue and lva...

@Xeo: I just removed my comment on your answer since it no longer applied.
@MooingDuck What happens to the old content of the stuff on the left?
I would assume that assigning an rvalue simply maps to swapping the vectors. ICBWT.
 
8:42 PM
@Ell: it gets properly deleted, sometimes during the move, sometimes when the temporary is destroyed
@Ell: I just addressed that to myself.... Yeah. Just swapping internals is usually how it works.
 
Ell
okay
this is what confuses me about value types
 
It can only do that if the right side is an temporary though. std::move(x) makes an object into a temporary, so it's data will be moved
 
Xeo
@FredOverflow Depends on the implementation I guess? You can implement it as a swap, or as clear -> move from rhs
 
@MooingDuck It is impossible to "make an object into a temporary". As I said, std::move casts to an xvalue. Nothing more, nothing less.
 
Because it's lunchtime and I'm eating and reading a book
 
Xeo
8:44 PM
@MooingDuck It disguises an lvalue as an rvalue, to be exact
 
Ell
hmm does the compiler need to support rvalue return optimisation to allow std::move? or did i jsut make that whole term up?
 
@Xeo: A lot of what I said is technically wrong. Don't confuse the poor fellow
 
@Ell RVO and move semantics are two distinct things. RVO already existed in C++98. move semantics is new in C++11 and kicks in if RVO cannot be applied.
 
@Ell: Return Value Optimization was a shortcut the compiler could take. std::move basically does the same thing.
 
@MooingDuck absolutely not
 
8:45 PM
rvalues are the ones you can't use & on, right?
 
Ell
okay so RVO does it when it can but std::move is sort of an explicit thing?
 
@FredOverflow Yeah
 
@Ell: right
 
Ell
okay :P
 
Isn't RVO copy elision?
 
8:46 PM
@Ell Depends. When you return an automatic object, move semantics is implicit (unless RVO kicks in, in which case we don't need move semantics). But you can explicitly request it in other contexts with std::move.
 
@Pubby: yes
 
Ell
okay
 
Why do you suppose someone would downvote this? stackoverflow.com/a/8449533/241536
 
Whoa, I didn't know benjamin lindley was the creator of en.cppreference.com/w/cpp
 
@Ell I highly recommend watching this video about rvalue references.
 
Ell
8:48 PM
i will watch :)
 
@JohnDibling bad day on the job, maybe?
 
@JohnDibling no idea
 
downvoting is fun!
 
I got a random downvote for stackoverflow.com/questions/8437791/…, I still don't know what it's for
 
It always boggles me why people downvote posts that clearly answer the OP's question correctly with thorough & complete answers simply because of a tiny little semantic error
 
8:50 PM
If you @ people not in the chat, will it notify them?
 
Yes @Seth
via the inbox
 
any VS tool to create a def file from a DLL?
I want to see if any msvcrt.dll functions can be used to implement C++ exception handling
 
Hi @BenjaminLindley, do you know about when the Iterators library page of en.cppreference.com/w/cpp will be filled in? That site is immensely helpful
 
cppreference.com is notoriously buggy
 
I would fill it in but I don't know anything about it so
 
8:52 PM
carpe diem, pal
 
sieze the day?
 
lol, erm
Caveat Emptor, pal. :)
 
buyer beware?
 
(said with a Chicago accent)
 
haha
Why is it notoriously buggy
 
Xeo
8:53 PM
anyways, I'm out, damn sleepy for some reason
g'night everyone
 
There are many errors on that site. It is useful as a quick reference to parameters etc, but don't look to is as a how-to-program guide.
 
@JohnDibling no, I just use it as a list of stl containers/algorithms and descriptions of what they do with param lists
 
Xeo
@JohnDibling I thought that was cplusplus.com?
 
one of those sites taught me c++. I think it was cplusplus.net
 
@Xeo: I thought it was both? Maybe I'm wrong.
 
Xeo
8:56 PM
I was linked to cppreference once, telling me that it's superior to cplusplus.com
 
I've always thought std::get_temporary_buffer() was interesting, but I'd want to learn more about when it's designed to be used.
 
@MooingDuck What happens if I need two temporary buffers?
 
Yeah I was always told that cplusplus.com sucks but I've never heard that about cppreference
 
@FredOverflow: Exactly. Is it good for that? The spec isn't clear. How is it different than allocating a block? When should it be prefered?
 
cppreference is very incomplete
 
9:00 PM
surprised more people don't add to it
 
I really wish this page: en.cppreference.com/w/cpp/iterator would get done
I might just read the standard and slowly start filling it out
 
@FredOverflow: Apperently the intention is it should be callable multiple times, and can fall back on new if needed, but it should in general be faster than new. However, stackoverflow.com/a/3264638/845092 says MSVC and GCC just use new.
 
headache
I have a feeling I'm doing my dependency injection all wrong.
I'm already Googling, but anyone have recommendations on material for learning IoC and dependency injection?
 
Oh, IEEE 754-2008 supports base ten? I didn't know that! Does any processor support them already?
 
9:09 PM
@Seth: That the question I linked to in my subsequent post :D
@FredOverflow: I'm having trouble thinking of a good use-case for that, except where you need to multiply and divide floating point values by 10 a lot.
 
The use case is being able to represent 0.1 exactly. You can't do that with base two.
0.1 is 0.000110011001100110011... in binary
 
@FredOverflow The IBM Power7 has a Decimal Floating-Point unit...
 
@FredOverflow: oh, so you can. Yeah, that'd be sweet for money
 
Ell
i dont understand why floating point has such trouble representing that :/
*stuff
isnt floating point just
 
@SethCarnegie When someone get's around to it I guess. Tell more (competent) people about it.
 
Ell
9:13 PM
an integer * time ^ exponent
?
so why is representing 0.1 so difficult?
surely the binary digit 1
 
@Ell <mantissa>*base^<exponent>
 
Ell
for the integer
 
@Ell Yes, but in base 2. And most finite decimal numbers are infinite in binary.
 
Ell
times 10
 
2 mins ago, by FredOverflow
0.1 is 0.000110011001100110011... in binary
 
Ell
404?
 
@Ell: it's because 0.1 can't be accurately represented by any M*2^E
 
Ell
i forgot it was 2^ and not 10^
 
0.1 = 0.000110011001100110011... = 1.10011001100110011... * 2 ^ -4
 
Ell
i never realised that
 
9:16 PM
since 0.1 is infinitely repeating in binary, as Fred says
 
@Ell Google: What Every Computer Scientist Should Know About Floating-Point Arithmetic
 
It follows the same logic as why 1/3 is repeating in decimal
 
@JohnDibling If you see errors, it would certainly be appreciated if you fix them. Or at least leave a comment in the discussion area.
 
1/3 can't be represented exactly in base 10
1/10 can't be represented exactly in base 2
 
You know what would be sweet processor instructions? log2(n) and itoa. and atoi. Intel needs to get on those
 
9:17 PM
@BenjaminLindley: I would, if I had the time. ;)
 
@rubenvb I bet that at least 90% of people posting a link to "What Every Computer Scientist Should Know About Floating-Point Arithmetic" have never actually read the text. If they had, they would realize that it is way too complicated to explain to a beginner what the problem is. I can explain that on one page.
 
@MooingDuck If you've done any VLSI, you'll know why they don't...
 
Ell
hmm 1.10011001100110011 * 2 ^ -4
gives 0.06 on my calc?
 
Did you enter the mantissa in binary or decimal?
 
Ell
well 0.06....
decimal
 
9:18 PM
well duh
1.10011001100110011... is 1.6
 
Ell
:P
teehee silly me
 
@Mysticial: I heard they had operations for strings that nobody uses anyway, it doesn't seem more complicated. And BCD
@Mysticial: Really, log2(n) at least should be trivial. Easier than integer addition.
 
so, the new streams are movable, right?
 
Part of the reason is that those kind of tasks are complicated to implement in hardware. They take up too much silicon, and rarely are performance critical
 
@wilhelmtell: Yes
 
9:22 PM
logarithms, even in base 2, are also very hard to implement in hardware...
 
then how come moving, say, std::cout into some function doesn't ruin the global extern?
 
@Mysticial: Not for integers. Floats yes, integers no
 
I find it very helpful for temporary streams, and am surprised to see it working for the global streams.
 
@wilhelmtell: You moved std::cout into a function? how?
 
You meant as in a bit-length instruction? They already have that
 
9:24 PM
@Mysticial: wait, they do? Really? huh. Can C++ access that? Or is it like the carry register?
 
I thought it was leading zeros or something
 
void f(std::ostream&& out)
wouldn't that do?
 
Correct, it's a leading zeros instruction - accessible only via assembly or compiler-intrinsics
 
@wilhelmtell: That doesn't move it, that's basically just acting as a reference
@wilhelmtell: std::ostream t = std::move(std::cout); moves it. And will probably mess everything up
 
@MooingDuck no i mean, call it with f(std::move(std::cout))
 
9:25 PM
Hello
 
@woodbrian: That didn't mess everything up? huh. Wierd.
 
hello friend
 
@MooingDuck hold on. i think i just answered my own question. :-S
 
@wilhelmtell: I guess there's nothing in the spec that says an object being moved from should be changed in any way. It's just left in an unspecified, destructable state
 
it's the copy elision that interfered. but if i tried harder i'm pretty sure i can really blow my leg off.
 
9:27 PM
So guys, how can it be that you have choosen C++ as your programming language?
 
@wilhelmtell: oh, copy elision might be it too
 
@TheBreadCat the door is to your right.
 
is there a way to have cl.exe mimic "gcc -S"?
 
@TheBreadCat: because it's awesome.
@TheBreadCat: No wait, better answer: because I have free will
 
Ell
c++ really is awesome
 
9:28 PM
(or not, it doesn't really change the response)
 
Ell
its so powerful
i never understood that before i learnt it
 
@Ell: and yet, relatively safe.
 
Ell
but it really amazes me
 
... powerful, yes. ask @wilhelmtell for tips on blowing your leg off.
 
@Ell: The more you learn, the more you find that C++ can't do though. Efficient arbitary precision integer addition for instance. Because we can't access the carry flag.
 
9:29 PM
@MooingDuck std::ostream&& r = std::move(std::cout); does not move, because there is no move constructor invoked here.
 
std::move doesn't move, it just gives you an rvalue, I think
 
your mother does the moving
 
Ell
@pubby we were discussing this earlier
 
std::ostream o = std::move(std::cout); moves.
 
Ell
it gives an xvalue :)
 
9:29 PM
@FredOverflow in your code r isn't an rvalue.
 
Ell
115
Q: What are rvalues, lvalues, xvalues, glvalues, and prvalues?

James McNellisIn C++03, an expression is either an rvalue or an lvalue. In C++0x, an expression can be an: rvalue lvalue xvalue glvalue prvalue Two categories have become five categories. What are these new categories of expressions? How do these new categories relate to the existing rvalue and lva...

 
@wilhelmtell Neither is any formal parameter an rvalue. So?
 
named rvalues aren't rvalue references.
@FredOverflow was just trying to explain why it wasn't moving.
 
You mean "named rvalue references aren't rvalues".
 
yes. madame pedant.
:p
 
9:31 PM
std::ostream o isn't an rvalue either, and yet std::ostream o = std::move(std::cout); does move.
 
is moving an official term? Or just a description of what's going on?
 
@Pubby "moving" is "invoking the move constructor" or "invoking the move assignment operator".
 
man
 
moving is an official term describing what I'll be doing in a couple weeks.
 
there's so much stuff here to parse
 
9:32 PM
@FredOverflow does a && constructor always move?
 
can you parse my life for me?
lulz
 
lol
 
@JohnDibling yeah AL sucks, im moving to BH..
 
I can't parse the files of my own language, I doubt I can parse your life
 
9:33 PM
@Pubby The "&& constructor", as you call it, does exactly what you define it to do.
 
@TheBreadCat you moving to Boo Hampshire?
 
@FredOverflow: At 13:24 I said std::ostream t = std::move(std::cout); At 13:28 you said std::ostream&& r = std::move(std::cout); does not move ... std::ostream o = std::move(std::cout); moves.
 
the move constructor moves.
 
@TheBreadCat Aren't those 8 bit x86 registers?
@MooingDuck My answer was directed at wilhelmtell:
9 mins ago, by wilhelmtell
@MooingDuck no i mean, call it with f(std::move(std::cout))
 
ohhh another cat appears :P
 
9:35 PM
foo(foo&& x) is this always a move constructor??
 
ah right. you're right. got me again
 
@tony no picture, doesn't count :)
 
@Pubby Yes, the standard defines this to be a move constructor.
 
@keithlayne I guess
 
9:35 PM
@Pubby However, nobody can prevent you from writing std::cout << "Hello World\n"; inside the move constructor instead of actually moving.
33
Q: Can someone please explain move semantics to me?

dicroceI just finished listening to the Software Engineering talk radio podcast interview with Scott Meyers regarding C++0x. Most of the new features made sense to me and I am actually excited about C++0x now, with the exception of one. I still don't get "Move Semantics"... What are they exactly?

Maybe you want to read this.
 
anyone read MASM? Or how it relates to the stuff GCC/Clang spit out?
 
I don't normally have a problem with move semantics, I just confused myself when he said he moved cout into a function.
 
Why would anybody want to move std::cout into a function, anyway? :)
 
@FredOverflow Thanks for the explanation.
 
you'll have to ask wilhelmtell
 
9:38 PM
so in the stream function case wilhelm mentioned, is there any real difference between using & and && for the arg?
 
I was just wondering the same thing actually. I can't think of a difference...
 
&&can't take an lvalue?
 
@Pubby right
 
oh, right. The difference inside the function is nothing, it's who's calling it that differentiates
 
so calling f(ostream&&) with cout as arg would not compile?
 
9:40 PM
right
rvalue references only bind to rvalues
 
which is why we have std::move() to make it compile. So you can blow your leg off.
 
Yes, because std::move(std::cout) is an xvalue, and all xvalues are rvalues.
 
so you all are really just conspiring to confuse me through bad examples? Thanks.
I mostly work with ubvalues
 
it's because we feel the need to give completely accurate information overload rather than explaining the simple concept.
 
@moo you're just using your psyduck powers on me now
 
9:43 PM
@FredOverflow was experimenting. i thought there was an issue with moving streams, but no, you need to try hard to make damage (use std::move() explicitly)
 
I counter with jigglypuff. booyah.
 
@keithlayne @MooingDuck I think the difference is in overload resolution
 
@wilhelmtell: Yeah, that's what I can't say
 
but it makes sense to sometimes have a move constructor/assignment operator without copy versions, right?
 
Ell
ooh dear i am stuck :/
 
9:46 PM
@keithlayne Yes, for example streams or locks.
 
Ell
or unique_ptr
 
@keithlayne std::unique_ptr is a classical example
(classical. pff. the standard is three months old)
 
Ell
yey i got there first! :D
 
@MooingDuck no it doesn't mean destroy
just steal
 
thanks guys
 
9:47 PM
actually the destruction part was one of the issues the kept people off the rvalues
 
rvalues are organ donors
 
because it's indeterministic now.
 
who needs to read when you can ask dumb questions here?
 
@FredOverflow lol saw that video of sutter, and i didn't like that analogy!
 
@keithlayne: THe people here you're asking
 
9:48 PM
@wilhelmtell Why not? I think it's awesome.
 
touche sir
 
Ell
right i have a probelm
 
Because organ donors somehow implies to me that they're about to die. but in fact they might live for a very long time after that.
 
Ell
i have a template called
 
@moo I'm not that lazy, I just have screaming kids running around. Have to wait until quiet time to get real work done.
 
Ell
9:50 PM
Graph<keytype, valuetype>
which contains Node<valuetype>
but the Nodes must contain a pointer to Graph<keytype, valuetype>
but they cant because they need dont know what type KeyType shuold be
does this mean i need to change it to
Node<keytype, valuetype>
even though KeyType is irrelevant?
 
they only die when they go out of scope.
 
you need something called SCARY
 
who? what? where? mm?
 
Or just make the Nodes a subclass of the Graph, and not templates at all. That's easiest
 
but more importantly, what's wrong with, e.g., template<...> class Graph { class Node { .... }; };
 
9:52 PM
@wilhelmtell does that mean possible concurrency problems cropping up with move semantics?
or is that easy enough to avoid if you're not dumb about it?
 
Ell
oh wait a minute
 
damn, what if I ask this guy to write an exception handling support library for LLVM: nynaeve.net/?p=99
He seems to have it all figured out :/
 
Ell
hmm
how would making Node a subclass of Graph help?
they still need to be templates?
 
not separately
 
a tiger
 
9:53 PM
a nested class can access the outer class's template arguments
 
subclasses are so underused :(
 
@keithlayne i think the new concurrency tools in C++11 rely heavily on move semantics.
 
Ell
oh can it?
i didn't know that
so i will make it a nested class (not a subclass)
 
@wilhelmtell I guess I need to read that part of the standard, thanks.
 
oh, heh. I just wrote my own implementation of any_iterator because it sounded awesome. I never heard the "Acronym" SCARY before.
(my implementation doesn't work btw)
 
9:56 PM
I haven't read the rvalue sectrions in the standard yet myself. i need to do more blog readings before i go hardcore with the standard. but i find dave abrahams writes well. he wrote quite a bit about rvalues (cpp-next.com).
 
thanks for the link, I've read a tiny bit of that, need to go back
 
This post is the first of a good series: cpp-next.com/archive/2009/08/want-speed-pass-by-value
 
Ell
argh god this is heavily bodged
 
well, I'm gonna hit the sack
 
In fact, I think Thomas Becker's article is better to start with. I think. Because it starts from the grounds up, with clear explanations.
 

« first day (419 days earlier)      last day (4544 days later) »