« first day (584 days earlier)      last day (4367 days later) » 

2:00 PM
I suck at C++ so please do throw your knowledge at me. I come to this chat just for the drama.
 
@Cicada yes, absolutely
never new directly, always use a factory function which returns the smart pointer of your choice, and do not ever call a de-allocation function, always use RAII (preferably through smart pointer).
also new[] is nothing but a Giant Pile'o'Wrong
 
I fully support what @DeadMG said.
 
Hey guys, I need to read a CSV file line by line using this code:
2
A: How to edit the first line in a text file in c++?

Jakob Borg#include <stdio.h> int main() { FILE *pFile; pFile = fopen("example.txt", "r+"); fseek(pFile, 7, SEEK_SET); fputs("19", pFile); fclose(pFile); return 0; } Edit: The above was of course mostly a joke. The real way to do it is to read the first line, spl...

 
I mostly support what @DeadMG said. you sort of have to use new to make a factory function.
 
@Cicada it's ok to have non owning pointers
 
2:03 PM
@stdOrgnlDave Very true. But that's more of a rare implementation detail, not general-case stuff.
 
How can I move forward one line, after reading a line using an instance of ifstream
 
@johnathon You know, I've been wondering if you can use reference_wrapper for that instead.
 
@DeadMG would you support a factory function template as sufficient for most needs?
 
@stdOrgnlDave How many allocators you using?
 
@EtiennedeMartel i have been too. But it's kinda arguable, as which is less typing
 
2:03 PM
@DeadMG in this case, one.
 
then, well, yeah, I guess
the Standard provides make_shared so that's fine
 
lolcakes
 
aaaargh
 
And Herb provides make_unique so it's even more fine.
 
Wikipedia, y u use shitty mathematical notation?
I can't click on a goddamn picture or Unicode glyph to see what two or three letter English word you replaced
 
2:05 PM
I get the feeling you don't like maths.
 
it's not very functional
especially when there's like three notations for the same thing
> In mathematics and logic, the infix operator is usually ∧; in electronics ; and in programming languages, & or and.
 
Ell
2:25 PM
hi guys
 
hi
 
Ell
whats this about reference_wrapper as non-owning pointer?
 
It's something I've been thinking about.
Basically, we need non owning pointers because C++ references can't be reseated, right?
 
@DeadMG if they used LaTeX for their maths mode then it'll have stuff like \forall in the source
 
@awoodland Not the symbol I was thinking of.
 
2:26 PM
But the problem is that it's still a pointer, so it's not exactly fun to use.
 
and I'm not gonna trawl through the page's source
 
Ell
why is it not fun to use? o.O
pointers are fun because anything can happen :D
 
@EtiennedeMartel Nullability too sometimes (though you never need nullability without reseating).
 
@Cicada Late, but since your question pinged me: yes, it means that – often you can avoid explicit dynamic memory allocation entirely – but to a much weaker degree.
 
2:32 PM
@KonradRudolph Thank you. Your slides made me think for quite some time (and still do). I tend to pass pointers around quite a lot to avoid copying lots data. From your perspective I guess that should be avoided, too?
 
@stdOrgnlDave I thought in the books it was really Mars, except it was the Mars of the start of the century.
 
@Cicada Not necessarily - there might be reasons to pass pointers, but you can probably get away with passing references in that case
 
At the time it was still totally not ridiculous at all to think Mars was inhabited.
 
@Cicada Pass around references ;)
 
@Cicada And if something needs to take ownership of an object, use an appropriate smart pointer, unique_ptr or shared_ptr and friends
 
2:34 PM
Also, copying is much less bad than often expected due to copy elision (e.g. when returning values)
 
RVO is mandatory in C++11, right?
 
Well generally it's many (hundreds) of small (~1KB) buffers.
 
@EtiennedeMartel But moves are mandatory where RVO is allowed.
 
@Cicada That said, the slides are of course meant to provoke strong emotions, and they definitely don’t cover all use-cases. But almost all uses of pointers by beginners are avoidable and bad
 
2:35 PM
Which is kinda weird.
The compiler has to detect all the copy elision criteria. Then it must move. But it can elide the move altogether, because copy elision applies.
 
@KonradRudolph Yeah those slides definitely made me think. Thank you for that! I'm gonna try copying the buffers instead and see what it gives.
 
@Cicada That doesn't sound like what you want either
Maybe I missed the motivation for this
 
You shouldn't need to copy objects just in order to avoid pointers/new
well, at least not nontrivial objects
 
Well I'm getting network data. Copy it in a giant buffer divided in sub-buffers. Pass the pointer to the sub-buffer and work on it.
 
Copying 1kb buffers around sounds like a terrible idea. But the alternative isn't to use raw pointers
 
2:39 PM
@Cicada So use a std::vector<char> and pass a reference to it
 
@jalf Then what is the alternative if not to point to the buffer?
 
@Cicada That actually sounds like a fine use of pointers to me … you’re essentially using pointers as cheap iterators here, no?
Or use @Collin’s way
 
I use themp to "map" memory regions as objects (ie, raw cast) to avoid fragmentation.
 
@Cicada But yes, as long as one thing owns that memory, passing around the pointers isn't so bad
 
Am probably doing it the "C-way"
 
2:41 PM
@Cicada pointers are fine as iterators, or when no ownership semantics are involved. Pointing to an object owned by others is fine use case for them
 
The fundamental point that my slides should have made is: Raw pointers should never, ever own memory
9
 
Okay.
 
but this point is way too complex for beginners, and that’s who the slides are aimed at
 
@KonradRudolph Or any other resource
 
@DeadMG Oh, yes :)
 
2:42 PM
How can a pointer own any other resource?
Oh, nevermind.
FILE*
 
@RMartinhoFernandes :))
 
afaik, there are CRT implementations on Linux which simply cast the integral file descriptor to pointer to implement FILE*.
 
@KonradRudolph I can't star this enough.
 
@KonradRudolph Out of curiosity, where are those slides?
 
and no, I did not create that shortlink
 
2:45 PM
@KonradRudolph Ha. I'll have to download those at home -- work doesn't like dropbox
 
@KonradRudolph It's one of the couple sites they overtly block, that and pastebin for some reason
 
@KonradRudolph You have to admit it is catchy and easy to remember.
 
@KonradRudolph and I can't get to my own website, but that's because I use sketchy free-dns to point to my server at home
 
@DeadMG I'm trying to understand if you're trying to say that FILE* isn't a pointer owning a resource (because it's an int disguised as a pointer), or if it is (because it is effectively the file descriptor):S
 
2:48 PM
what I'm trying to say is, my pointer owns your mother
2
 
@RMartinhoFernandes Oh, definitely. That’s why I could post it now without looking it up ;)
@DeadMG snaaap!
 
@DeadMG I have to keep track of their original positions because some asshole programmer was bent on validating fields by position rather than id
 
@DeadMG So, you like MILFs?
 
And I've decided against that route in the end since it's likely going to create many tiny tiny bugs which sprout every 6 months
 
3:04 PM
How do you <hr> in a post?
Oh.
<hr>
Right.
 
@Cicada three dashes on new line … ---
 
Thanks!
 
I woke up way too early this morning
should have gone back to sleep when I realized heating was not on and it was early
 
Ell
its boiling outside :o
first good weather of the year :L
 
3:19 PM
This thing has 4.3 stars on Amazon amazon.com/The-Haunted-Vagina-Carlton-Mellick/dp/097624988X (potentially NSFW), and reviews include sentences like "Mostly though, it's a great, touching, and very human story."
 
@casperone is on some kind of closing/deleting rampage.
 
@Potatoswatter again? Don't tell jalf
 
Is he a repeat offender, then?
I don't know one mod from another.
 
Ell
I wish I had these powers :'(
 
he just deleted a correct answer with the most upvotes, and re-closed a question which was closed, constructively edited, then reopened.
Of course comments aren't appropriate in such situations, that would slow down the process of running amok.
2
 
3:27 PM
@Potatoswatter casperone is the mod that is fastest with the deletes on SO, and deleting comment chains. He's the mod that Jalf/we have the most problems with.
 
@RMartinhoFernandes Just looking at the URL makes me fear for my employment status.
 
By the way where did that genesis kid go.
 
@Cicada well that's something you don't here every day :P
 
@EtiennedeMartel I decided to keep my job too
 
@thecoshman What do you mean?
 
3:29 PM
@Cicada Who?
The guy who power flagged everything?
 
Yes
 
we raged at him pretty hard and he never came back, afaik
 
@Cicada just as a standalone sentence, it's a funny thing to read
any way, off home for me!
 
@DeadMG I read that as "we raped at him pretty hard"
 
Ell
Has anyone used yaml-cpp before?
 
3:31 PM
@EtiennedeMartel Whilst it would be not unusual for me to state that I raped someone pretty hard, such a thing only makes sense in the context of RTS.
why "rape" has become synonymous with "own" in the RTS circle, I don't know
 
@DeadMG I prefer "pwn".
 
@Cicada His profile reads "I'm now gone. Bye everyone."
 
Ell
I prefer real life rape.
 
Amazing. Tell us more.
 
Ell
Sorry that was of bad taste
 
3:32 PM
by the way, I also suggest that you call your local police force and detail this to them
I'm sure they will be highly interested in hearing about your conquests
 
"Spread the love"
 
Ell
"conquests"? :P
 
@DeadMG I think they're all plans and dreams
 
I fucking hope so.
 
A group of chess enthusiasts checked into a hotel and were standing in the lobby discussing their recent tournament victories. After about an hour, the manager came out of the office and asked them to disperse. “But why?” , they asked, as they moved off. “Because,” he said, “I can’t stand chess-nuts boasting in an open foyer.”
 
3:36 PM
@Neil No.
 
I warn you, they only get worse from here.
 
The heck just happened?
 
huh?
 
Ell
@Neil I don't get it :L
 
3:39 PM
Out of the blue, @Neil tells some story about chess players (I'm suspecting there's a pun somewhere, but I'm not getting it), you "answer" with no, and then he says it only gets worse.
All that seems totally random.
 
@RMartinhoFernandes The "No." is about how terrible his pun is.
 
@RMartinhoFernandes chess-nuts boasting in an open foyer ~= chestnuts roasting on an open fire
 
What the pun?
 
"The Christmas Song" (commonly subtitled "Chestnuts Roasting on an Open Fire" or, as it was originally subtitled, "Merry Christmas to You") is a classic Christmas song written in 1944 by musician, composer, and vocalist Mel Tormé (aka The Velvet Fog), and Bob Wells. According to Tormé, the song was written during a blistering hot summer. In an effort to "stay cool by thinking cool", the most-performed (according to BMI) Christmas song was born. "I saw a spiral pad on his piano with four lines written in pencil", Tormé recalled. "They started, "Chestnuts roasting..., Jack Frost nipping.....
 
chestnuts
 
3:40 PM
see, you can't even tell, because it's so incredibly terrible
 
Even a frenchie like me got it. So the joke must actually be terrible.
 
Holy. Shit cake. On a motorbike. This pun sucks.
 
Hah, wait! There's more!
 
Please don't.
 
A woman has twins and gives them up for adoption. One of them goes to a family in Egypt and is named “Ahmal.” The other goes to a family in Spai. They name him “Juan.” Years later, Juan sends a picture of himself to his birth mother. Upon receiving the picture, she tells her husband that she wishes she also had a picture of Ahmal. Her husband responds, “They’re twins! If you’ve seen Juan, you’ve seen Ahmal.”
 
3:41 PM
THE GOGGLES! THEY DO NOTHING!
Damn that pun is terrible as well.
 
@MooingDuck Oh gawd. It's awful.
 
I don't get it
 
Juan ~= one, Ahmal ~= 'em all.
 
@DeadMG twins.. seen one you've seen them all
 
Ell
ohh em all
 
3:42 PM
That's it, I'm officially bat shit bonkers.
 
Ell
I'm a twin
 
@Ell Are you the source or the copy?
 
I'm a single twin.
 
Ell
@MooingDuck I think im the copy
 
here's an interesting fact
 
3:43 PM
Okay, enough torture for now
 
I hate it when I accidentally a huge commit with hundreds of completely unrelated changes.
 
if you take any of the 8 SHA-2 32bit outputs, their results depend on every state of the algorithm
so arguably, they add little additional information to the has
 
@RadekdaknokSlupik Commit often and you will make a fine programmer and husband.
 
sha-2 is broken, everyone use whirlpool!
 
@Neil but I always forget. xD
 
3:45 PM
This message sponsored by the year 2050.
 
@RadekdaknokSlupik Me too, admittedly, but doesn't mean I shouldn't just the same. ;)
 
I don't have to worry about being a good husband
no woman would ever put up with me no matter how much I committed
 
@Neil Do you use Git?
 
Are you removing yourself from the gene pool?
 
Ell
3:46 PM
I wish I had someone to commit to ;'(
 
@RadekdaknokSlupik No, but I ought to. SVN is starting to become outdated
 
So you're basically saying that your whole genetic branch is a failure
 
@RMartinhoFernandes not voluntarily
 
That's over 4 billion years of repeated failing.
 
3:46 PM
@Neil Mercurial > git
 
@Cicada Humans have ways around that.
 
@DeadMG I've heard bad things about Mercurial, but not about git
 
We don't just let the weak, old, and sick die. We can reproduce without the desire to find partners.
 
@DeadMG I used Mercurial briefly, but have used git much more now
 
IOW, fuck you evolution.
 
3:47 PM
@RMartinhoFernandes How exactly? I can only think of gamete donations.
 
@Neil They're pretty similar, except git is completely unusable as far as I can tell
 
@Cicada Exactly.
 
git unusable. wat.
 
@DeadMG Couldn't tell you, honestly. What's unusuable about git?
 
@DeadMG wat?
 
3:48 PM
I'm glad you won't be transmitting your genome indeed.
 
Fuck this shit I'm going to start over.
 
@Cicada That's what she said.
 
@RadekdaknokSlupik Famous last words.
 
No actually that's pretty literal, so nevermind.
 
deletes tens of hours of work
 
3:49 PM
well, as far as I can tell, it has a command-line-only interface, and the only thing I've heard about it is that it's a complete mess from start to finish
far from TortoiseHg's nice shell extensions and such
 
Ell
git? whats up with git?
 
CLI is awesome.
 
Ell
It's the only thing I've used (I don't use version control audience inhales) but found it fine
 
CLI is the most primitive worthless crap since C-style strings
 
@DeadMG There are git GUIs. It even ships one out-of-the-box.
 
3:49 PM
@Ell Git's cool.
 
I admit it's not obvious to get started with git. But after a while it really gets osom.
 
Ell
@RadekdaknokSlupik I agree
 
@Cicada Everyone else just thinks "Let's use Hg and put that while to productive use."
 
CLI si the one only thing that Windows truly lacks.
 
@DeadMG I read on a blog somewhere that git tends to eliminate those situations you'd otherwise have with clearcase or svn involving sentences that start with, "What you were supposed to have done was.."
 
3:50 PM
I use a GUI for Git, the CLI is really a piece of FUCKED UP SHIT.
 
Ell
Yeah, I couldn't use windows git
 
lol Windows
 
@Neil Yeah, because nobody knows what you were supposed to have done with Git.
 
Ell
But I just can't use windows so
 
That's a good thing.
 
3:50 PM
besides, Mercurial is the DVCS competition, not SVN or .. clearcase? isn't that a font type or something?
 
@RadekdaknokSlupik Totally. I think the best evidence is the fact that there are efforts to make alternative CLIs for git.
 
@DeadMG ClearType
Horrible way of anti-aliasing text.
 
text is best aliased anyway
 
y’all folks never heard of GitHub for Windows?
 
3:51 PM
@DeadMG I've seen worse. Our company adopted IBM's clearcase, ironically not because it was considered better but because IBM owed us, so we picked the worst of two evils that is IBM software.
 
Random question. Can a compiler actually optimize an iteration that uses vector<T>::size() in a loop that doesn't change the vector? From what I've seen no, but could it be?
 
@Neil Just ask for a cash payment
 
3:52 PM
@KonradRudolph Neat UI. What is that. W8?
 
@Cicada Absolutely, and I'd expect it to
 
@Cicada It could. The standard allows it. As long as the result is the same.
@KonradRudolph it cannot be any worse than GitHub for Mac.
 
@Cicada Metro … but as far as I know it should run on Windows < 8 as well
 
@DeadMG If it were up to me I would have, but then, if it were up to me, I'd probably have spent the money by now on beer and video games.
 
even Hitler hates Git
 
3:53 PM
@Cicada The compiler can do whatever it pleases as long as the observable results are the same. Just FYI Execution time doesn't count for as an "observable result" for that effect.
 
@KonradRudolph lol that anti-aliasing of text.
 
www-01.ibm.com/software/awdtools/clearcase if anyone is morbid enough to want to know what clearcase is.
 
@Neil What, they screwed up before and gave you store credit?
 
@RadekdaknokSlupik Which is also actually quite nice for visualising stuff. Well, I only use the command line, but only because I find that graphical tools really don’t help with version control (except for branch overviews and merging)
@RadekdaknokSlupik So? It’s a well-designed UI
 
That Metro style is very slick
 
3:53 PM
@KonradRudolph it hurts my eyes. I haven't used it though.
 
Yes, GitHub for Mac is an abortion of a source control GUI, but let's hear how bad IBM is.
 
Anything that begins with Rational® sucks.
 
Ell
@DeadMG hitler also hates jews :L
 
I like GUIs because they allow me to see what I actually changed before I do a commit.
 
@Potatoswatter I honestly don't know. There was a sort of running tab for a long time and we were sort of pressured to use it up. At the time we were using svn and we had some problems with it, but not nearly as bad as we did with clearcase. That was a true nightmare indeed.
 
3:54 PM
@Ell So do I, although not enough to start exterminating them
 
@RadekdaknokSlupik Why?
 
@KonradRudolph the anti-aliasing of the text in GitHub for Windows I was talking about.
It's horrible.
From the screenshot, at least.
 
@RadekdaknokSlupik bullshit
 
@KonradRudolph Because it lacks the je ne sais quois Apple logo.
 
text is supposed to be antialiased
 
3:55 PM
I know, but if you do it, do it well.
And not half.
 
it looks like they use ClearType
 
I have nothing against anti-aliasing of text. I'm saying that the anti-aliasing is done badly. It should've been done better.
 
@RadekdaknokSlupik I guess you're too used to Linux-like AA
 
that counts as “do it well” in my book
 
@Cicada Mac OS X d:
 
3:56 PM
How did we get on font? I said clearcase, not cleartype, people!
 
Or Fag OS X
 
@DeadMG Oh my.
 
Imma Macfag.
 
As a Mac OS X user, I agree completely with any criticism you might send at my OS of choice.
 
@EtiennedeMartel Damn, you guys took forever to notice that
 
3:56 PM
@Neil No one wants to talk about ClearCase. The only people that know anything about it are too traumatized.
 
@Cicada OMG. /kickban
 
@EtiennedeMartel Your OS sucks.
 
@RadekdaknokSlupik This is not 4chan, you know.
 
@RMartinhoFernandes I need to ventilate :(
 
@RMartinhoFernandes I know. We usually do discuss about the same topics though.
 
3:58 PM
@RadekdaknokSlupik Not that much. Although the developer side of things sucks huge balls.
 
@KonradRudolph Is that disallowed? I'm new here.
 
Nothing is disallowed.
 
@Cicada Rule #1: take no one seriously.
 
I still want to see somebody say op is a fag in a comment on Stack Overflow, though. xD
 
Well, maybe the big angry ape.
 
3:59 PM
@Cicada Insulting people? Nah, it’s actually required. But this insulted me. Not cool, man!
 
@RMartinhoFernandes Alf as well.
 
@EtiennedeMartel yup. At least they should allow for customizing their IDE with plug-ins, and ship it with the latest clang.
And ship the OS with tools like git, wget and ncat.
 
@KonradRudolph Insulted you? Why, are you a Mac user?
 

« first day (584 days earlier)      last day (4367 days later) »