« first day (444 days earlier)      last day (4489 days later) » 

12:02 AM
typedef foo<bar> qux; won't instantiate foo<bar> unless I use qux, right?
 
Not that students care about those proofs, but the professors trying to land research grants sure do.
 
user142019
@RMartinhoFernandes exactly.
 
Xeo
@RMartinhoFernandes Yes, and even then it might not instantiate qux depending on the use
 
Ell
does java do all allocations on the heap? or does it allocate on the stack too? or is there no such concept?
 
Java has a split type system.
local primitives go on the stack, everything else on the heap.
Unlike .NET, in Java you can't define new value types, you're restricted to the built-in primitives.
Like .NET, those primitives can get boxed for polymorphic use.
 
Ell
12:06 AM
does that mean all primitives are copied when passed as arguments to functions?
 
Yes. I believe so. Of course, if you're passing a boxed value, that doesn't count as a primitive.
 
Ell
when stuff is boxed, it becomes allocated on the heap doesn't it?
 
the boxed version of a value is a full-blown object, stored on the heap.
consider int vs java.lang.Integer.
C# int is an alias for System.Int32, both are value types. In Java, int is a value type and java.lang.Integer is NOT.
 
Ell
do you know anything about ruby and how that does it?
 
(I think an int becomes an instance of java.lang.Integer when boxed, anyone know for sure?)
@Ell ruby? Not I.
 
Ell
12:09 AM
and thankyou :D
 
@BenVoigt Yes.
In .NET the boxes are unspeakable types that derive from Object.
 
like cthulhu is unspeakable
 
user142019
brb
 
Xeo
class : public old_god{} cthulhu;
 
sbi
@Xeo, I sent you a mail with the code for that game.
 
Xeo
12:17 AM
Yay, thanks.
 
Good evening gentlemen.
 
sbi
Good night!
 
Xeo
@sbi Oh, even with usage rules. :)
 
@Xeo Cthulhu is not an Old God. It's a Great Old One.
 
Who's @WTP? A rising star, pardon the pun?
In SQL, if a COMMIT fails, is there harm in executing a ROLLBACK? Or, is it even necessary? Will it have an effect?
 
12:22 AM
In some DBs there's an auto rollback mode or something.
 
git is da bomb - after a day or two of getting used to, it kicks major svn-ass
 
It does. I think it takes more than a day or two to figure it out though. Unless you start right away by reading the Git For Computer Scientists article.
That article alone gives you about 90% of what you need to master Git.
 
sbi
@wilhelmtell He share two of his initials with you. You appear the moment he disappears. You ask about him. Now what do you think we should make of this?
 
aye - can tell there's a ton of features I'll prolly never used - but after a day or two, it's dead obvious that git is better - thx for the link
 
sbi
Anyway, I really, really need to go to bed now. Good night again!
 
12:28 AM
Sockpuppetry!
@sbi Good night.
 
bare vs working directories were really mind-boggling at first, but I think I'm getting the hang of it now...
 
@sbi g'night
@sbi lmao
Yesterday I had a moment of falling in love, when I realized a moment after writing a deleter for a shared_ptr that I can just pass in a lambda. Tears in my eyes.
 
Xeo
would be even better with polymorphic lambdas
 
or auto in lambdas. but nonetheless.
 
@Xeo grumpy old man
Am I really the only one who borderline-hates lambda syntax? Especially with trailing return types. Spelling out those param types... All the parens/braces/brackets you can think of. Useless return and ; for single expressions. Hand my Boost Phoenix:
 
12:37 AM
@sehe Yes, that syntax is awful.
Especially if you're used to C# or Haskell.
 
BEGIN TRANSACTION
  -- ...
COMMIT  -- failing here
ROLLBACK  -- is this ok?
 
auto upper = irange(1,100) | filtered(arg1 % 50);
@wilhelmtell: your ascii graph is not accurate for that. I'd say the rollback is implicit if the commit fails.
But refer to your DB vendor docs because some commit may be re-tryable
 
Xeo
@sehe I don't see it as that bad.. for example, you can specify if you want a reference or a copy of the parameter.
 
The syntax is still awful.
 
but db transactions should be atomic. so it's all or nothnig. so even if the transaction is still alive after a failed commit, it should gracefully die (rollback) when disconnecting, no?
 
12:40 AM
Yes, it has to pack a lot of stuff in it, but that doesn't make it pretty.
 
@Xeo yeah I can imagine why its useful too. It's just tedious. How about auto& like in rangebased for
 
Xeo
@sehe That'd be polymorphic lambdas
 
@wilhelmtell Always
 
Xeo
Like I said, I want those.
 
@Xeo I know. I'm following Dave's thread on CppNext too :)
 
12:41 AM
Hopefully they'll come in C++17 with concepts :)
 
And modules. And garbage collection. And highlevel parallelization in the standard library.
 
Xeo
I mean, of course things like std::cout << _1 << '\n' are better than [](some_type const& a){std::cout << a << '\n'; }
 
@Xeo I got it. Don't know when your order will be served, but we'll send note to the kitchen
 
@sehe That last one seems to be on for TR2.
 
@RMartinhoFernandes Oh really? Linky?
I'd've thunk I'd read such at Bartos Milewsky's or Christopher Kohlhoff's presentations
 
12:44 AM
@sehe I read it in Williams Concurrency book I think.
 
@RMartinhoFernandes In Action or In The Real World?
 
In Action.
Comes out this month.
 
So you read the early access versions? I'm putting it on my list.
Book-Santa comes before summer with me :)
 
Been postponing buying this book too. :-S On my list though.
Also, Bartosz Milewski has been doing nice video tutorials on concurrency with C++11.
 
1:07 AM
@wilhelmtell: I thought they were rather tame. It may be partly due to his excruciatingly slow speech, though
 
Yes, I find his tone a bit of a challenge to follow. But I find him really good at expressing complex ideas.
I hate, hate hate hate those "lecture visualizations", those stupid drawing animations people wrap talks with. I hate them. So distracting, so damaging, so useless, so ARGH. They're like ketchup on a healthy delicious lentils soup.
 
I feel that way about video tutorials in general. A blog post is so much better for comprehension.
 
Video is good if it has a sense of art. It's an opportunity for another form of creativity. But if you just read out something or do a screencast or just plain talk then yeah, it is a waste of bandwidth.
 
"No flying cars yet?", he wrote from a 2 inch by 4 inch pocket computer instantaneously to subscribers worldwide using only his right thumb.
 
Why do I feel like I just contradicted myself?
@RMartinhoFernandes there's a recursion in that.
i think i just ruined a joke.
oy.
 
1:22 AM
too bad gc isn't optional in go
 
Go is actually quite cute.
 
never tried
but enforced gc ... i donno about that. unless it's a scripting language.
well
lisp is good
but you get my point.
 
I actually like go's idea of polymorphism (better separation of data and methods) - but I can't turn off the gc 8^P
 
Go has a system a bit similar to Haskell typeclasses.
C++ with concepts would be pretty close too.
 
ah - I should jump back into Haskell - played with it only for a few days a while back
 
1:37 AM
friend or member?
 
operatotr<<(). friend or member? i don't think i'll need lhs conversions.
 
Xeo
Neither
:P
 
need the privileges ...
 
Xeo
Implement it in terms of the public interface
 
1:39 AM
well
there's a thoroughly private member i need to change.
 
Xeo
Well, I guess that operator<< is your public interface in that case? Or why not make a public add_something method that the operator calls?
It may be desireable to not only use the stream version, but also normal member functions
for function binding, for example
 
well. now that you mention that.
exactly
yeah.
that makes sense.
i'm starting to worry myself. i was about to abuse friendship. what an asshole.
 
Xeo
lol
anyways, I'm off. see ya tomorrow
 
take care!
 
 
2 hours later…
3:15 AM
is it safe to pass a lambda to a function that takes a function pointer?
void f(void (*)(void*));

// ...
f([](void*){});  // safe?
The f() call links against a static C library
 
Yes, a lambda with no captures converts to a function pointer.
No, it's unsafe in the language semantics to use as extern "C", but your ABI probably allows for that anyway.
 
There, I gave myself another exercise in Boost Spirit :)
0
A: Boolean expression (grammar) parser in c++

seheHere is an implementation based on Boost Spirit. Because Boost Spirit generates recursive descent parsers based on expression templates, honouring the 'idiosyncratic' (sic) precedence rules (as mentioned by others) is quite tedious. Therefore the grammar lacks a certain elegance: Abstract Data ...

@Potatoswatter And I think VS2010 doesn't implement that yet.
 
3:37 AM
@Potatoswatter The standard guarantees that?
@Potatoswatter i don't follow
I don't mean to expose the lambda to C. On the contrary. I have a C function that takes a function pointer, and it's a static library (so already compiled, probably with a C compiler) to link against.
 
@wilhelmtell Yes, it's specifically guaranteed.
 
@wilhelmtell You want to expose the function "within" the lambda to C through the function pointer. Since C and C++ are allowed to have completely different calling conventions, that's not OK. But most C++ ABI's simply extend C, so you're OK in practice as long as you stick to C-safe types.
 
jn
uh huh, who kicked me off the room owner list?
and johannes back in...
changes
 
turn and face the pain, ch ch ch changes
 
3:46 AM
i'm gonna brew some hot chocolate
 
0
Q: Addition of new responsibilities without impacting existing design of a C/c++ application

JimmI have requirement where the component is responsible for receiving a message and process the message. There should be a generic message interface such as unit8 array (it is a binary message) and a generic framework, reads from an external configuration file, a list of handlers. The handlers sho...

"C/C++" again.
 
> I have implemented this approach many times in java, but i am struggling to implement it in c/c++.
^ punchline
 
Considering there is no such thing as "C/C++", of course he's struggling.
"I tried to implement a client/server system using only the innards of a recently slain unicorn, but unfortunately I was unsuccessful"
 
Also mumbling for three paragraphs about components and requirements and generic generic generic without really saying what he wants to do… typical Java, and Not a Real Question.
 
I answered the newest C++ question.
I'm nice.
0
Q: Taking char 'e' as input and comparing

FuddlebuttsOK, so I am doing an exercise in a book, converting different types of money to dollars. For some reason when I type in 'e' as input for a char variable and compare it to 'e' in an if statement the comparison doesnt work, however if I replace it with another letter it will work fine. What's the...

 
3:54 AM
Yeah, I saw that question.
 
scanf is evil. I assume that >> in C++ is also? Parse your input people!
 
generally speaking, yes.
 
@RichardPennington >> does type checking, scanf does not.
 
>> and << just construct scanf/printf format strings and call the C library.
 
but it's still evil to use >> without checking for success/failure
 
3:56 AM
@Potatoswatter Not necessarily.
 
@EtiennedeMartel for numbers they do.
Or is there an interesting exception?
 
@Potatoswatter not as of C++11. they got rid of that UB. happily, :)
 
@Potatoswatter It's implementation dependent.
 
Who do I ask to elevate me as a room owner? :)
 
3:58 AM
@EtiennedeMartel Yes, the "as if" rule. But the subset of printf and scanf behavior they access is convoluted enough.
 
@wilhelmtell because you want to change the room description
 
yup.
:p
 
oh, "who", not "why"
you can ask sbi
or anyone who is a room owner
anyone who is a room owner, please add wilhelmtell and me (yeah, someone kicked me off that list)
 
If there are no room owners here now, this is very ironic. The whole point is that an owner is always present, right?
 
@Potatoswatter: how so?
A room owner just owns a room. No need to be present at all times.
 
4:02 AM
@sehe From what I heard, I think from sbi, room owners are selected based on attendance.
 
I think the whole concept of "room owner" in the C++ Lounge is backwards. Almost everyone should be owners, except the very very new ones.
 
or the very old ones.
 
@wilhelmtell: care to explain why?
 
This is why I've never been a room owner. I've been participating since it was new, but I only log in for a few hours at a time.
 
well. that's pretty much how everyone here roll. an hour here an hour there.
 
4:03 AM
plenty of us don't become owner - I never was. I also don't care - what is different about being owner?
 
but the thing is about 90% of the participants here are usuals.
very few passer-bys.
 
usuals. care to explain why usuals should be room owners? I still don't know what is so special about room owners. Except, that we can fight about what the room title should be
 
> If you wonder why we have so many room owners: This room was originally created by some user(s) who later disappeared, orphaning it, so that other users set up a new C++ room. A moderator objected against two C++ rooms, and transferred ownership of the older C++ room to those who had created the new room (which was then left to die).
 
It is suck, as of now :)
 
> To prevent this from ever happening again, we have the unofficial room policy to turn regulars into owners (and to remove those no longer regulars in the chat from the list of owners). If you hung around here almost daily for a few months, it's likely someone added you as an owner.
Quoted from the newbie hints.
 
4:05 AM
I am the 99%. Occupy Lounge<C++>!
 
@EtiennedeMartel O shute. Can you tell I haven't read them (fully). Then again, I'm not a newbie (anymore) - weehoo
 
Sorry, I got carried away.
 
@EtiennedeMartel Thanks for the quote. I might read those hints some time soon, now
 
So, I'm probably going to be a room owner in a few months.
At least that's my goal.
 
 
2 hours later…
^ Nice playing :.)
 
The playing is actually nice.
 
7:13 AM
That video snapshot did catch my attention as a newbie. Cool =_=
 
Xeo
Mornin
@AlfPSteinbach > Unfortunately, this SME-music-content is not available in Germany because GEMA has not granted the respective music publishing rights.
GAAAAH D:
 
@Xeo The music is "jeff beck - dirty mind".
The video is just this screenshot.
 
Anyone actually heard of "seven and a half post-increment operators" ....? Browsing a C++ question on SF, stackoverflow.com/questions/8708384/why-this-code-compiles
 
7:18 AM
@xeo can you fix the room ownership things?
 
Xeo
@StackedCrooked I as interested in that screenshot. :P
@AlfPSteinbach ?
 
well someone kicked me off, and wilhelmtell wants to be able to change description
 
Xeo
@sbi cleaned up the room owners a bit a while back. As a general rule, if you're in the top 10 frequent users, you qualify as a room owner.
 
@CppLearner Question starts with: "I have a code." ಠ_ಠ
 
7:22 AM
i think it's interesting that YouTube require you to log in to demonstrate your age, because of that single screenshot :)
still, i managed to post the video on facebook
 
@Xeo Uh, that should be "regularly in room." And that's just what I was saying earlier about attendance.
"Frequently in room" would reward rapidly jumping in and out.
 
Xeo
?
 
@Xeo Their terminology is off.
 
Xeo
Ah, yeah
 
These CS guys have no reasoning about frequency analysis.
 
Xeo
7:25 AM
But that "frequency" is a function of your actual time here, the number of messages you write, and when you were last here
 
@Potatoswatter You're allowed to leave the chat every now and then!
 
@LucDanton Yes, but the point is not to achieve a high frequency of oscillation.
 
Xeo
lol
 
Xeo
@alf, @wilhelmtell is not a frequent user here. I'm not sure if @sbi won't remove him later again
 
7:31 AM
Storm is rising...
 
well that's his busyness then :-)
 
I mean literally, here.
:D
 
Xeo
Storms are cool
 
Yay, possibly fun walk to work.
 
Xeo
 
7:46 AM
I am under the impression that you like this Touhou thingy.
 
Xeo
Nah, I don't know how you got to that conclusion
 
Guess I've been jumping to conclusions again.
 
8:28 AM
It was merely a little windy on the way to work. I am disappoint.
 
Xeo
8:43 AM
0
A: Can the type of a base class be obtained from a template type automatically?

XeoIt's possible with C++11 and decltype. For that, we'll exploit that a pointer-to-member is not a pointer into the derived class when the member is inherited from a base class. For example: struct base{ void f(){ std::cout << "base::f()\n"; } }; struct derived : base{}; The type of &...

Any improvements to be made here? :/
 
> As the last example shows, you need to use a member that is actually an inherited member of the base class you're interested in.
I guess, yes :D
Anyway +1.
// maybe something like this might work
T base_of(R T::*, enable_if< is_baseof<R, T> >);
Just brainstorming though...
 
Xeo
9:03 AM
Err, R is just the member type. :) For a function, it'll be void() for example, and for a variable int.
 
Yeah.
 
Xeo
Interesting
template<class T, class R>
R base_of(R T::*);
Doesn't compile
error C2893: Failed to specialize function template 'R base_of(R T::* )'
With the following template arguments:
'base'
'void (void)'
But T base_of(R T::*) compiles just fine
Ah, I know why
functions returning functions are illegal, as such the base_of gets sfinae'd
 
sbi
@StackedCrooked You mean literally, here, in this room? :)
 
@sbi I mean literally near my apartment. But I was thinking of you as well.
In the end it turned out to be just a little wind. But on the 14th floor the wind is always stronger.
 
Xeo
I just noticed that it actually should be pretty easy to unsingletonify my resource management code \o/
 
sbi
9:17 AM
@StackedCrooked Yeah, I'm not interested in making a big fuzz. :)
 
Happy new year to you all :D
 
Never mind, it's too early for this kind of discussion :)
 
Xeo
0
A: How would I write a for loop to check each pixel for collision?

XeoWaaaay to complicated. Have a free function which takes in two positions and two collision boxes and just use a simple check: // y ^ // | // +----> x struct position{ int x, y; }; struct bounding_rect{ unsigned w, h; }; // simplified struct object{ position pos; bounding_rect bo...

This answer I just made reminded me of a picture from our math lessons:
(Yes, our prof actually drew that live.)
 
Damn... got my first downvote for the first time in 40 days... Rep no longer divisible by 5. :(
 
sbi
@StackedCrooked I missed that, had a phone call to take.
 
Xeo
9:31 AM
@Mysticial I'd need one to make it divisible by 5 again. :)
(No, that should not encourage you to downvote one of my answers.)
 
@Xeo lol, given my history... Anything I downvote is destined to be deleted... :)
I give myself a 50/50 chance of being able to rep-cap to offset it...
 
hi
 
sbi
9:59 AM
Anyway, yes, I disagree with more than a dozen room owners. I have looked at other rooms. Many have one or two room owners, one has five, the Java room has seven. The C++ room stands out like a needle on an armchair cushion. Which I think is fine — to a certain degree.
This is a busy room. We sometimes have >30 users logged in in the middle of the week. If we make everyone a room owner who has been here more than thrice, we're bound to see some incident one day. It's not that I distrust some specific user here, but I think that, if you are on the room owner list, you should know all of the other room owners very well, and they should all know you very well. So we got to draw the line somewhere.
I understand that this is a problem, because, due to the fact that, in theory, anybody could become a room owner, becoming a room owner in the C++ room became a kind of a privilege to earn. That makes excluding someone who's been here for a while almost an offense. I think that's silly, but that's the way it is. (Trust me, I really know that. Every time someone discovered they got kicked off the list, they swear into my direction.)
Which is why I came up with the idea of using the list of regular users as a criterion. There's ten users on that list, and ten owners ought to be enough for everybody. Also, it's a purely objective criterion. And it perfectly fits the description of "regular users". But so far, that was just my private criterion, and I am — deliberately and intentionally, I want it that way — not the only one who has a saying in this.
 

« first day (444 days earlier)      last day (4489 days later) »