« first day (685 days earlier)      last day (4264 days later) » 

9:00 PM
@sehe Interesting
 
@R.MartinhoFernandes The latter will interest you, having prior C++ experience
 
@NikiC A function as in a function pointer, or as in a callable thing?
 
For C++ memory management, there's really only two "tools" you'll need.
RAII and smart pointers.
 
@NikiC That's @R.MartinhoFernandes's blog
 
Coq bends minds.
 
9:00 PM
oh man, AskReddit NSFW threads are hilarious
> I solved a portal 2 puzzle i was stuck on mid-climax... that was definitely the weirdest "ah-ha!" Moment I've ever had.
lol
 
AskReddit still exists?
 
sorry guys for breaking up your conversation, carry on :P
 
@sehe Not sure what you mean
 
MSVC's std::function uses SBO. Neat
 
@sehe Oh, a nice answer of mine about the badness of std::function arguments. I didn't remember that one.
 
9:01 PM
I understand virtual memory, I'm more questionning myself about memory framentation, malloc() , free memory, garbage collector... (the last one is a joke)
 
@R.MartinhoFernandes In particular lambdas, but also callables in general
 
@CatPlusPlus yep, mostly shitty questions, but occasionally a good one
 
@R.MartinhoFernandes Thanks for the link
 
It's a cesspool, why are you there.
 
9:02 PM
@R.MartinhoFernandes Oh sorry, I missed that one
 
@NikiC You can static_assert that it is callable.
A is_callable trait is a nice tool. Maybe I should blog about that.
 
@R.MartinhoFernandes We did. Luc still didn't get around to it:
2 days ago, by Luc Danton
It's still in my aims, but not done yet.
 
@sehe Yeah, I know.
 
@bokan Heard of RAII?
 
@bokan Ah, okay. For C++ management, follow these tips, in order:
 
9:03 PM
@Nils SCARY!
 
1) Use RAII
2) If RAII isn't appropriate, use smart pointers (which is really RAII in disguise)
 
@NikiC Whatever you do, don't take std::function arguments. Not only it adds overhead as you seem to have found out, but it also messes up other things. It was not created for that.
 
@Insilico "If RAII doesn't work"?
 
@Insilico Rephrased: if you write new, you're doing it wrong. If you need Rule Of Three, question your class design
 
@MooingDuck Changed it to "isn't appropriate"
 
9:05 PM
@NikiC I usually just do something like template <typename Fun> void fun(Fun&& fun) { do_stuff; fun(42); }. The compiler will complains if it's not callable with an int.
 
Okay, second revision:
1) Don't use new or malloc().
2) Use RAII everywhere
3) Don't use new or malloc().
 
@sehe Scary? We should have a list of all acronyms..
 
@Insilico Smart pointers are RAII.
 
In pimpl, you might want to maybe allow a delete inside a destructor (Andrei's stance) but I don't fully agree. unique_ptr all the way
 
@R.MartinhoFernandes yeah, that's why I just use templates for callables. But i don't particularly like that method because you don't get a signature
@R.MartinhoFernandes Yeah, exactly that
 
9:06 PM
You can decompose a function type into signature parts.
 
@Insilico Ok so I look for RAII in google
 
@Insilico mine is: "if you clean up after yourself, that's wrong." (unless that is your entire job)
 
-3
Q: About the following encryption

ChristianIt's 3:00am and I'm still trying to identify the steps used to encrypt the following. I've reached at the following conclusions : The characters are being XORed The characters are being shifted and the amount depends on the length of the string Characters at pos[0] aren't shifted at all The da...

 
@CatPlusPlus Not in general.
 
@bokan So in summary, use RAII instead of new or malloc. If you think you absolutely have to use new or malloc, there's a 99% chance you're still wrong.
 
9:06 PM
@MooingDuck Lol.
 
All this downvoting because you can't come up with an answer? — Christian 28 secs ago
 
@Insilico Nah IMHO it breaks down that you have to know, at the time when you write new how your memory is freeed again.
 
Awww look, someone is getting a little butthurt.
 
Thank you evrybody , I now have enough tabs open to let you for hours
2
 
@NikiC It used to irk me to, but now I'm used to it...
 
9:07 PM
@Drise Classic.
 
@NikiC The main problem is that you can't find out the signature in some cases (objects with templated or overloaded operator() for example).
 
@Nils Eh. Everything in this room is to be taken with a grain of salt anyway. :-P
 
So your best bet is to do nothing (let the compiler find the errors), or static_assert that it is callable (which needs a trait that for some stupid reason doesn't exist in the standard), or use SFINAE if you want to overload depending on the callable that is passed in.
 
@bokan Be sure to pick up "Effective C++" by Scott Meyers, since he talks quite a bit about RAII and smart pointers in that book.
 
@R.MartinhoFernandes There's some sense to that
 
9:08 PM
But any non-stupid C++ intro book should cover it as well.
 
@Insilico I just read Effective Java and found it very interesting
 
(emphasis on "non-stupid")
 
The static_assert is probably the best option because it yields the best error messages.
 
@bokan I don't think that's written by Scott Meyers. He was involved in the book's making, but I'm pretty sure he didn't write it.
 
@Insilico Yeah, but most of that is hardly interesting since TR1, boost and C++11. Unless you need to write your own smart pointers. Which you don't, today /cc @bokan
 
9:10 PM
@CatPlusPlus He's begging to be destroyed.
 
@sehe Rule of zero > rule of three :)
 
@sehe True, it was relevant when I picked it up (which was way before C++11)
 
@Insilico It still is, for individuals wanting to know how the standard library does stuff. What goes on in <memory> and <utility>, e.g.
@Drise Nobody ever is. Calm down
 
I constantly forget to #include <utility>, and I probably need it in every TU.
(Un)luckily, it always gets included by some other header.
 
@Drise damn, just a second late to post my comment:
> @Christian hacking is not a bad thing. It is just the term for this, you know, reverse engineering encryption is hacking
 
9:15 PM
hello?
 
@Wesley Yes?
 
@Wesley Goodbye!
 
is that a question!
Ok. We're a bit edgy here
 
haha i was just confused because nothing was poping up
 
Nothing ever popes up.
 
9:16 PM
@sehe Ooo People in funny hats?
 
i mean the chat wasnt moving
 
Don't get your popes up!
@Wesley We lack a poet
 
@Wesley If this chat isn't moving, I don't what is.
 
An omission
And [tag:teen-drama]
 
Why. Am I still. Back in the PHP room.
 
9:17 PM
im new, go easy on me
 
@sehe There's a joke somewhere in that sentence, I just don't know what it is.
 
whats the chat messages on the right
 
@Insilico Pope, hope
 
@Drise Entertainment?
 
@Wesley Starred messages. A.k.a. the starboard
 
9:18 PM
@Insilico Chat keeps putting me there!
 
@Drise Naw, something more offensive.
 
@Insilico That too.
 
@Drise You marked it favourite on this page: chat.stackoverflow.com/?tab=favorite&sort=active
 
oh thats cool
 
@Wesley It's just a bunch of messages people starred for any reason whatsoever.
 
9:19 PM
@Wesley in particular the top one is cool:
Aug 25 at 22:00, by sbi
If you are new here, please read the newbie hints right away, and only post here afterwards. Thank you.
 
@Insilico I frequently run out :/
 
Who starred that?
 
@sehe Who else but the guy who is always running out.
 
@sehe They managed to star the wrong post, methinks.
 
@Insilico nah. just random acts of boredom
 
9:20 PM
lets be realistic, who is going to read all of that just to chat?
 
@sehe The entire Lounge<C++> room is made of random acts of boredom, no?
 
@Wesley You.
 
@Drise just not out of rooms
 
@Wesley Well, if the alternative is that you will asks stuff that is explained there ;)
 
@sehe Clever!
 
9:21 PM
@Wesley Everyone. Or you'll probably wish you did
 
You don't have to read it, but you must accept that people get annoyed if you ask stuff that is answered there.
And welcome.
 
Urff :)
 
i asked one question and you guys are flipping out
 
@Wesley We're always flipping out.
 
@R.MartinhoFernandes And typing with perfect grammar, with periods and stuff.
 
9:26 PM
Not everyone does that.
I do, but no one will chastise you for omitting periods (many regulars write like that).
 
11 mins ago, by sehe
Ok. We're a bit edgy here
@R.MartinhoFernandes But those who don't get ridiculed
 
@Wesley Feel free to write as you want (jst dn't use stpid abbrvs; those r n wel recvd)
@sehe Only @thecosh
 
Uh, C++ has a lot of syntax
 
It does?
 
@NikiC Haha, I can't help but laugh. I'd love to see your face right now.
 
9:29 PM
Just reading through rmartinho.github.com/2012/08/15/rule-of-zero.html and saw a few syntax elements I didn't know :/ Can only guess what they do
 
@NikiC Just too little of the pythy syntax :)
@Wesley You haven't seen anything yet:
Apr 8 at 6:10, by Domagoj Pandža
Elementary, the poet says! Perhaps comparable to the concept of integration, or the eternal differentiation? Some will say: "Is he mad?". And to that, the poet says: "Quite, and I'm glad!". For I contemplate the vastness of space, while the cops introduce civilians to mace. It was to preserve peace, they said. Might as well get a maid. How does a maid factor in? Well, she keeps the house clean. Is this... Abstract? A polymorphic start? An interface in design? I do not know, it seems benign.
 
Xeo
@NikiC Where did that come from?
 
: handle { ::LoadLibrary(name.c_str()), &::FreeLibrary } {} pretty much sums up my confusion ^^
 
@NikiC That's a member initializer.
 
Xeo
uniform initialization <3
 
9:31 PM
But with list initialization.
 
@NikiC Try this: [](){} or the 'vagina operator' :)
 
I mean, I know about initializations, but never saw that {} syntax
 
In this case, it's the same as handle(::LoadLibrary(name.c_str()), &::FreeLibrary) {}.
@NikiC It's new in C++11.
 
So, I have a few questions: I have never made anything useful in C++ but I am familiar with Python and PHP. I often hear things about memory management/allocation/leaks, where would I learn about these kind of stuff?
 
Jun 13 at 23:31, by Radek Slupik
// this conversation reminds me of the C++11 "vagina operator"
std::vector foo({});
 
9:31 PM
@sehe That's the C++ variant of the Haskell (.).(.) boobs, right?
 
When does RAII was invented ?
 
@Wesley Scroll up. Read everything addressed to @bokan :)
 
@R.MartinhoFernandes What's the advantage of using {} over () there?
 
@Wesley Rule of three
 
@Wesley Oh, you're the second one in a couple of hours! If you read the previous messages, you'll see lots of recommendations to bokan.
@Drise Rule of zero!
 
9:32 PM
@R.MartinhoFernandes Even better!
 
@Wesley I can explain you everything now ! :)
 
@bokan haha that would be nice
 
@R.MartinhoFernandes But you don't have a fancy faq post that I can link to.
 
@NikiC In this particular case? None, I guess. I prefer {} because it avoids some nasties of () in some cases, so I got used to it by default now.
@Drise I have a blog post.
 
@Wesley You have to use RAII and smart pointers
 
9:33 PM
@R.MartinhoFernandes I don't know where to find it
 
then your C++ memory management will be even more easy than with JAVA
 
@bokan With a tenth of the overhead!
 
@Drise I have no idea what you guys just said
 
@Drise Phew. You found it.
 
I know what the words mean, just not when you use them together
 
9:34 PM
@Wesley wreee! Fun right?
 
@R.MartinhoFernandes Is there a nice linky on that?
 
So no one to tell me when RAII arise ?
 
@NikiC Hmm, maybe. Gimme a moment to grep.
 
I had no RAII in 1995 when I was coding in C++, all by malloc()
 
@bokan Resource acquisition is initiation?
 
9:35 PM
yes
 
@bokan It 'arises' when you initialize/allocate resources in a constructor, and release them in the destructor.
 
I mean when was it born ?
 
@bokan Clean up your bullshit, everyone is happy
 
?
 
@Drise ?!
 
9:36 PM
Can anyone explain whatever you guys just said in english>
 
@sehe It's true!
 
@bokan I don't know when it was invented, but I know it was in there by the time of the first standard (1998). I think @Fred might know when, and if he doesn't he'll check TD&E. Right, @Fred? ;)
 
@Wesley I'm sure we are speaking English.
 
I don't even know where to start, any suggestions would be nice.
 
@Drise And I'm sure you still need to cool down since that 'encryption' question.
 
9:37 PM
@R.MartinhoFernandes ok I see in wikipedia that the first reference is a book from 1994
 
@bokan Stroustrup, I wager
 
@Wesley for the most part, if you have to remember to do something before a function finishes, it belongs in a local object's destructor. That's the soul of RAII.
 
@sehe I'm sure that the encryption question is not where this started.
 
@Drise Your overexcitement, yes. (Not just you, mind you)
 
It's a pitty I didn't knew that memory management had become easier in C++, I spend 16 year being afraid of doing C++ again because of this.
 
9:37 PM
@sehe Surely, no. Do I have to once again search for when I said "Oh fuck fuck"?
 
std::string::substr is total bullcrap
it accepts the wrong arguments
 
@Wesley @bokan asked for help about memory management here just a few moments ago: chat.stackoverflow.com/transcript/message/5181409#5181409. If you read from there, you'll see a bunch of links to get you started.
 
@Drise Okay. tell me where it started. Tomorrow
@KonradRudolph Much like a girlfriend
 
@KonradRudolph It does?
 
@sehe Nah, they accept no arguments
 
9:39 PM
@KonradRudolph I generally hate that std::string isn't more like std::vector<char>
 
@KonradRudolph That std::string's interface is pretty bad is a well known fact.
 
@Drise Yes … it wants from and count. That is inconvenient in many common scenarios. It would make more sense to accept from and to
 
@R.MartinhoFernandes bokan seems to be a lot more advanced that I am with C++
 
@KonradRudolph Meh, I like to say start here and give me 5 characters. Maybe because I'm a VB.NET programmer at heart
 
Is memory management something I should be worrying about if I am only coding website backends?
 
9:40 PM
@Wesley Then you may gain a lot from a reading an introductory book. stackoverflow.com/questions/388242/…
 
Does anyone have resources about the underlying processes of memory management ? I wonder how it handle fragmentation.
 
@Wesley In C++? Ha!
 
@KonradRudolph Oh, I can pass them, but the interface is really awkward. Since marriage, we got some SFINAE going on and the error reports on failure to supply valid arguments are easier to understand now :)
 
@Drise Sure, but there’s a common idiom where substr is used in a loop together with find to extract tokens
 
@KonradRudolph Hm... good point.
 
9:40 PM
@Wesley thank you for the compliement
 
@Wesley once you get the hang of RAII, you never have to worry about memory management for anything
 
@KonradRudolph IME that is also inconvenient in many common scenarios. Both suck.
 
In fact, this just annoyed me so much that I wrote a thin wrapper around substr just so that I wouldn’t need to make the loop more complex
 
@R.MartinhoFernandes Thanks
 
@bokan You might want to read up on heap libraries (google's tcmalloc has a nice article, IIRC) and perhaps Boost Pool (if you're serious about optimizing that - prematurely?!)
 
9:41 PM
4
Q: C++11 initializer lists + uniform initialization

Robert MasonI've been playing around with C++11 for the past few days, and I came up with something strange. If I want to uniformly initialize an int: int a{5}; But if I do the same thing to a std::vector: std::vector<int> b{2}; Does not construct a two element array, but rather an array with on...

 
@MooingDuck honestly I learned all my coding skills from youtube and google. I am coding website backends right now and I am just wondering if memory management is something I should be worrying about
 
Aug 27 at 19:55, by Mooing Duck
@rubenvb Drise has been in a bad mood lately (for completely justified reasons)
 
@Wesley No.
 
Among many other realizations by @MooingDuck that my fiance leaving for germany and then breaking up with me has made me almost hateful (surely this is not the word I'm looking for).
 
@CatPlusPlus Thanks. And one more question: Is memory management pretty much essential to C++? Is it possible to build a C++ program without knowing anything about memory management? Let's say I go through a C++ book, would it talk about memory management or is that something advanced?
 
9:44 PM
@NikiC There are probably other interesting posts around. Check the and tags if you want to read more.
 
@Wesley Nobody sane does memory management in C++.
 
I thought there was a on this, but didn't find it.
 
Use smart pointers.
And values.
 
@CatPlusPlus What do you mean?
 
@Drise Oh well. I notice quite a jump in erratic conversation starting with exactly this comment:
> @ Christian -1 because you're taking offense to downvotes.
 
9:45 PM
@sehe thank you
 
@Wesley RAII/SBRM.
 
Jul 27 at 0:07, by Mooing Duck
@Drise you seem stressed, go watch a tv show, eat some pizza.
 
Instead of being angry on the internet, you should do something fun.
Do you want EVE invite?
You can shoot people and ruin their day.
 
So, who's up for writing/finding a on list initialization?
3
 
@CatPlusPlus Meh. Requires money after most likely addicting trial.
 
9:46 PM
@R.MartinhoFernandes Will do, thanks
 
Well, trial is 21 days, so you can decide whether you want to buy or not.
Also, after a while, you can pay for subscription from in-game currency.
So you can play for free, if you put some mild effort into it.
 
@CatPlusPlus I'm one who is easily addicted to things. I try to avoid them if I can forsee it becoming an addiction.
 
(And no, you don't have to play 28 hours a day for that.)
@Drise But spaceships!
 
@Wesley if you're not using RAII, then you have bigger problems than memory management. if you'r using RAII, then no, you don't need to worry about it
 
@NikiC The best thing IMO, is that the most vexing parse is over: std::vector<int> x(); would declare a function that takes no arguments and returns a vector, instead of declaring an empty vector. std::vector<int> x{}; is always an empty vector.
2
 
9:48 PM
@CatPlusPlus And I think I already bought DayZ because of you. And bought a 1500$ computer to play DayZ on. But zombies!
 
@R.MartinhoFernandes "that the most vexing parse is over" dream on.
 
@R.MartinhoFernandes Good point. Never realized that
 
I bought a lot of games.
 
@MooingDuck Even VB.Net now has a vexing parse :)
 
@MooingDuck What?
 
9:50 PM
Jun 21 at 14:01, by Cat Plus Plus
DayZ is cool.
Jun 21 at 14:41, by Cat Plus Plus
@Als Play DayZ.
Jun 20 at 15:41, by Cat Plus Plus
Dammit, so many stories about DayZ.
 
Well, it is. But doesn't have spaceships.
 
We get it
 
Jun 21 at 8:00, by Drise
@CatPlusPlus You made me intrigued by DayZ. Now must play lots.
It's you fault.
 
@Drise He's like that. He gets addicted to something and then annoys everyone to get into it as well.
 
So you bought a fun game, so what.
 
9:50 PM
Gladly he doesn't do meth or something.
 
I just want people to have fun. :(
 
@CatPlusPlus Yes, but now you want me to buy another!
 
@Drise Responsibility issues?
@CatPlusPlus And not be heard
 
@CatPlusPlus Anyway, what are you building with Coq?
 
Nothing yet. I'm just trying to wrap my head around basics.
 
9:52 PM
@CatPlusPlus It can get annoying sometimes. And getting annoyed kind of spoils the fun.
 
Fiiiiine.
I'll play alone and be miserable.
 
I think I know about fun, because my players regularly refer to me as the best GM around. </bragging>
 
@R.MartinhoFernandes That's interesting
 
I wanted to get into RPGs, but I'm not very good at pretending to be other people.
 
@CatPlusPlus So? One of us always plays himself, no matter how much he tries not to. He just can't help it. It's still fun.
 
9:54 PM
@R.MartinhoFernandes My minecraft kids regard me as a god. Just sayin
 
I don't want to play myself. :<
 
Anyway, you'd have to go out and get a group of people, so it's probably too much for you :P
@CatPlusPlus Why not?
 
> 2,147,483,647 zombies killed.
Why does that look like max_int?
 
They're not very good at programming.
 
@CatPlusPlus (I suck at that too, and that's why I prefer to GM)
 
9:59 PM
Btw, any minecrafters?
 
is there a way to get SO to search for a deleted question? I just remembered an old funny one I wanted to favorite
@Drise yes
 
I didn't play for a while.
 

« first day (685 days earlier)      last day (4264 days later) »