« first day (332 days earlier)      last day (4614 days later) » 

2:00 PM
With a global stateful API you're screwed to an even higher degree.
 
oh I see
 
Which is why you shouldn't attempt to appropriate std::cin and std::cout.
 
hah I see
 
@LucDanton why did .clear() work?
or make it work?
That just clears error flags
 
Presumably one of the flag was set.
 
2:01 PM
If your stream was in an error state, clearing that helps.
 
@LewsTherin The stream can't "go anywhere" while a flag is set.
 
If one of the flag is set then no extraction/insertion operation will succeed.
 
Not looking it up, but the flag state might also stop str from taking effect.
 
Oh, that's cool then
 
so that e.g. stream >> i >> j >> k; is a no-op as soon as extracting to i fails.
 
2:02 PM
oh interesting :P
so you really should check the error bits then before doing that operation, if the stream has been used before?
 
Yeah, apparently
 
Normally you should check after each operation that can potentially fail.
(And handle that otherwise what's the point.)
 
Isn't there a way to clear the input stream without pressing enter? All the methods end up with me pressing enter
 
So if you get in a state where the stream is in a fail state but you didn't anticipate it's a programmer error.
 
And do it with if(stream) is generally preferred over if(stream.eof()) or however it is that the kids are learning wrong these days.
 
2:05 PM
Gawd no! eof is the bastard bit.
 
stream.fail() fuck I have no idea, just check for if(stream) or its converse
 
Just do if( stream ) and be through with it.
 
@RMartinhoFernandes what's wrong with eof() ?
 
Or not
 
@TonyTheLion Usually, it's not what you want to test for.
 
2:06 PM
Lately I've also been using if ( stream && stream.ignore().eof() ) to make sure everything was consumed properly.
 
@RMartinhoFernandes oh I see, but you do if you really want to know if it's the end of a file?
 
@Potatoswatter you still have to press enter using .ignore()
 
@TonyTheLion No.
 
@TonyTheLion In that case, I don't see a problem. But I'm not sure what case that is.
For example, while(!cin.eof()) { cin >> s; } is wrong.
 
@LewsTherin For interactive input, you're not looking for eof
 
2:07 PM
@TonyTheLion You can't tell it's the end of file beforehand. You have to attempt an operation first and then check. 'Is it eof? then proceed' is not right.
 
no should be while(cin >> s) {} right?
@LucDanton hah, I see
 
@TonyTheLion That's a correct use.
 
@Potatoswatter I mean after input...to consume those bloody newlines
 
ok
i get it now
 
using cin.ignore(1) requires an enter
 
2:08 PM
The standard input streams are line-buffered (not sure if it's standard, but it's common to all implementations I know).
 
@LewsTherin You don't expect to reach eof on cin so I don't see how what I said applies in the first place.
 
Have to use a third-party something if you want to have finer-grained control.
 
I was referring to your use of .ignore()
 
You could
getline( cin, line_of_text );
std::istream line_stream( line_of_text );
int value;
if ( line_of_text >> value && line_of_text.ignore().eof() ) { ... }
else { throw syntax_error( "expected one number on this line" ); }
 
@Potatoswatter Why the ignore() call?
 
2:12 PM
but of course you will never look at cin.eof() because unless you're using a pipe or redirected file, you won't reach it.
@RMartinhoFernandes Because the damn eof bit isn't set when peek reaches eof, only when an eof would be consumed.
So the extractor doesn't set the eof bit even though it "sees" one.
 
Oh, the if is to really test if there's nothing else.
 
OK question, how does on clear input stream without pressing enter?
Nothing bloody works
 
ignore will set eof but not bad or fail, which makes it special.
 
I get it, but most of the time there's more stuff to read.
 
You do this once you know there isn't ;v)
 
2:15 PM
Now that I think of it, my .torrent reading code is not checking for that. I could add trailing data and it would not complain...
Hmm.
 
Jesus, cin.ignore(100) and my program hangs :(
 
Um, you can't just pound randomly for a while and press return?
 
If I was a random user I would think it crashed :(
btw do you hate potatoes? Or something
 
I love potatoes, but I am also an excellent defense against them.
 
Lol..sure
mmn...
 
2:26 PM
So, if I'm attacked with a potato, I know how to defend myself now!
Good, I was only ready to defend myself against fresh fruit, now I can survive against potatoes too!
One step closer to invincibility.
 
What if you are attacked by potatoes?
 
Unlike robots, potatoes don't have free will.
 
Robots have free will? What is that, Skynet?
In my world a potato can attack you
 
First, the banana!
 
Your weapon can kill you
 
2:29 PM
Potato cannons can be pretty serious…
Anyhoo, does anyone consistently use class instead of typename to distinguish template parameters that really must be classes?
 
No.
I always use typename.
 
typename is easy to understand
 
I don't find the distinction "must be classes" very useful.
Is strtok_r in C++11?
Ah, nope.
 
Anyway who really needs more than the std::string extractor? :vP
 
Is there something like an eval in c++?
would be useful
 
2:33 PM
Ah, it's POSIX, optional.
 
@LewsTherin GTFO.
 
lol :P
 
Anyone knows anything about the C++ POSIX thingy?
 
5
Q: C++11 alternative to localtime_r

PotatoswatterC++ defines time formatting functions in terms of strftime, which requires a struct tm "broken-down time" record. However, the C and C++03 languages define no thread-safe way to obtain such a record; there is just one master struct tm for the whole program. In C++03 this was more or less OK beca...

 
POSIX thingy?
 
2:35 PM
@Potatoswatter could be useful if it was fast
 
^ how to call multithreaded POSIX functions without requiring them to be present.
(A technique which is safe if you assume that all multithreaded implementations provide said optional functions.)
 
> The behavior of a C++ program is undefined if it adds declarations or definitions to namespace posix or to a namespace within namespace posix unless otherwise specified. The namespace posix is reserved for use by ISO/IEC 9945 and other POSIX standards.
@TonyTheLion This thingy.
Hah, I won. Take that Markdown.
 
Oh. I think they expect that implementations will start putting POSIX in ::posix instead of ::.
 
@Potatoswatter No, no, there's a C++ POSIX interface in the works.
 
@Potatoswatter I don't know if they expect it, but rather it's been discusssed a few times, and I suppose they just want to reserve the namespace so that if it is ever used for POSIX, there won't be any conflicts
 
2:38 PM
@RMartinhoFernandes Which, I'm guessing, will consist of putting POSIX is ::posix?
They aren't gonna give us RAII file objects or anything, right?
 
@RMartinhoFernandes oh I gotcha
 
@Potatoswatter Would they need a standard for that? I'll see if I find the vague link that led me to believe this, gimme a sec.
 
what's the purpose of doing a char c - '0' again?
 
> C++ binding will be provided only where they offer additional benefits to C++ programs over the C binding.
@TonyTheLion Getting a number from a digit character.
 
I need advice
If I had 2 players how would I choose which one the enemy should track?
Unless it depends on the closest one I guess
 
2:47 PM
I think that while the syntactic change of putting POSIX in ::posix is easy, putting the C linkage functions behind the namespace might take more work on the C++ side.
 
@Potatoswatter But that wouldn't provide a big benefit over the C binding, would it?
 
@LewsTherin Whoever you want it to track?
 
@RMartinhoFernandes It would stop global namespace collisions, which is a relatively big deal.
 
yesh...
mmn
 
If you're writing an AI, you can start with a simple behaviour and add more tricks on the go.
 
2:49 PM
Anyway, they say they only want to provide a "thin" interface with no new behavior.
 
@Potatoswatter Meh, only if you like to pollute it too :)
 
@CatPlusPlus Leave the "wipe out humanity" bit for last, IMO
 
Honestly I don't know what it is, I can't find a thing about it.
 
@CatPlusPlus good idea
 
@jalf That's lifeform-ism.
 
2:50 PM
Speciesism.
 
lmao
 
Robots don't have species.
 
@RMartinhoFernandes You mean because I'm unfairly generalizing about AIs wanting to wipe out humanity?
 
@jalf Right.
 
@RMartinhoFernandes you didn't say why Robots have free will?
 
2:51 PM
So then it's just roboticism. You're a roboticist!
 
@LewsTherin I'm proof!
 
An AI is just software, though. It doesn't become a robot until you give it a body, does it?
 
@RMartinhoFernandes you are a very smart robot xD
 
A sufficiently good AI should be able to acquire a body.
3
 
Maybe conscious-entity-ism? (I'm assuming this kind of strong AI requires some form of consciousness)
@Potatoswatter What would it want one for?
 
2:52 PM
Brain to brain protocol.
 
@RMartinhoFernandes To kill all humans?
 
@RMartinhoFernandes to kill us all? To enslave humanity yada
 
Missiles do that very effectively.
 
I could be John Connor
 
Well, if the AI was controlling the missile, then the missile would be a corporeal form…
 
2:54 PM
If I were Skynet, I would send naked nuclear missiles back in time, instead of robots.
Or maybe robots with nuclear explosive devices.
 
a suicide robot
 
Because I'm much smarter than Skynet, I just lack the killing instincts.
 
Sorry dude, but Brianiac is smarter
He will wipe you and us all out the face of this planet
 
IBM is using Watson for publicity, but really their hopes are pinned on Moriarty.
 
So, anyone knows where I could acquire a basic set of killing instincts for a relatively low price?
I promise I'll use them only for my own good.
 
2:58 PM
@RMartinhoFernandes Al-Qaeda?
 
lol, Cleverbot just got meta. It's asking me "How can you tell if a machine is smart?"
 
Hell, any kind of vaguely military organization will do that for you. Or take boxing lessons.
Woops, boxing lessons are expensive. Forget that.
 
@jalf You got trapped with Cleverbot too?
 
@RMartinhoFernandes not really. This talk of AIs just made me load it up
 
I searched the whole Internet and couldn't find any transcripts from the "Turing test" Cleverbot "passed" that involved only humans :(
 
3:01 PM
what's this Cleverbot?
 
Why the spaces?
 
My hand must have slept on the spacebar :(
 
passed out at the bar, eh?
 
Tonight, I will :P
 
Oh, since everyone's here this time, watchya think? dl.dropbox.com/u/26824/temp/chat1.png
 
3:04 PM
looks cool
 
Why does that cat look terrified?
 
cause he's a terrified cat
 
@CatPlusPlus Ugly. And too many cats.
 
lolcats
 
What's ugly?
 
3:06 PM
@RMartinhoFernandes what's ugly about it?
 
"chat" is French for cat, right?
 
Colours all over.
@Potatoswatter Yes.
Also, this "Totally not me" dude seems boring.
 
I like how you can format code though...I still don't know how to
 
@CatPlusPlus and why did you implement flagging?
lulz
 
Sep 10 at 15:03, by R. Martinho Fernandes
If you are new here, please read the newbie hints. Thank you.
 
3:07 PM
Yo dawg, I heard you like chats so here are some cats with your chat so you can chat while you cat.
 
Als
So I am back!
 
@Als ohla
 
Als
@TonyTheLion: holler
 
yelo
how are you today?
 
Als
Yo Im back and posting again :P
 
3:11 PM
Yes you are
 
Als
Let the votes flow in: :)
1
A: Derived class with non-virtual destructor

AlsIt is perfectly valid to have an derived class with an non virtual destructor if you are never going to call delete on a Base class pointer pointing to an derived class object. Follow Herb Sutter's Advice: Guideline #: Only if derived classes need to invoke the base implementation of a virtua...

 
What's all this obsession with votes?
either that or flagging
 
@Als I think you got confused there.
Did you mean "It is perfectly valid to have a base class with an non virtual destructor if you are never going to call delete on a Base class pointer pointing to an derived class object."?
 
Als
uh derived clas
wait i need to edit
 
(And then that won't answer the question though.)
 
Als
3:14 PM
uhm why that
 
Because I think the question is about struct Base { virtual ~Base(); }; struct Derived { ~Derived(); };.
I could be wrong though.
 
> (...) in which it is legitimate for a derived class to have a non-virtual destructor?
 
@TonyTheLion lool
 
Als
ofcourse once destructor is virtual in base
 
3:16 PM
Reboot ALL the humans!
 
Als
its virtual in derived inherently
is that the q?
 
@RMartinhoFernandes yikes
 
@Als Yes, yes, I know. And that should be the answer, don't you think?
:)
 
hmm on car of lesbians :P
 
Or a chained womanizer
 
Als
3:17 PM
@RMartinhoFernandes: lulz now i need to ask if he really means derived
or maybe edit
 
@TonyTheLion really?
 
@Als Though it seems like others are missing that too.
 
@LewsTherin yea
 
yeah right lol
 
Als
3:18 PM
oh im gonna edit the answer to add that, @RMartinhoFernandes: You have a sharp vision :P
 
he doesn't need to see it.. He is a bot
so he claims
 
@Jerry claimed it first!
 
Oh well, didn't know that.. I heard it from you first :P
 
Started the day with downvotes :(
 
3:21 PM
Happens to all of us.
 
Als
@Mahesh: Oh those are imaginary points anyway
 
Well, not all of us.
 
Als
@RMartinhoFernandes: I stopped giving a shit about it
 
That's good!
 
Als
@RMartinhoFernandes: thanks to you and folks over here :)
 
3:22 PM
@Als - Taken.
 
Als
@Mahesh: Taken? What Taken
@TonyTheLion: hows the thing you were gonna try today going?
 
@Als - That they are imaginary points.
 
@Als what?
pots
if you want one...
 
Als
@TonyTheLion: You were to hunt today, I suppose
haha pot why? We already have an bot @RMartinhoFernandes :P
@Mahesh: Because they are useless in real world.
 
@Als Why so? I am proudly keeping that in my resume' :)
To an extent, it will at least get me an interview call
Don't you think so?
 
3:30 PM
@Als yea going ok, sending out things, not getting much response though
Nerds win
 
Als
@Mahesh: How do you make it a part of your resume?
 
You write it there?
 
Other activities
IEEE member, SO rep
etc.,
For a fresher, these things add up as I believe
I mean entry level jobs
 
@TonyTheLion xD
 
@TonyTheLion It's a mockup, there's no backend yet.
 
Als
3:37 PM
@RMartinhoFernandes: You are a mind reader or something?
"Does Destructor in Derived class needs to be virtual if Base class Destructor is virtual?" Yes, that is really my question. – Raedwald
 
But flagging can be done right, it just cannot be voting with the action deferred by ages.
 
Yes, I'm a descendant of R. Giskard Relentlov.
4
 
We are talking about flagging again ?
 
Als
@LewsTherin: You are like 65 rep old, But you seem pissed about rep as if you are @65k
Same applies for flagging
Whats up with you? Premature maturing?
 
65 rep old?
"Premature maturing?" Apparently so
 
Als
3:40 PM
Yeah, you can't hide that :P
 
Why should I?
 
Hey, 100% of his answers are accepted! That's god-like.
 
Als
@Potatoswatter: A nitpick He himself asked that Q
 
sbi
It seems I keep hitting subjects where I nobody can/wants to help me. I just posted another one today. :(
 
3:41 PM
 
@CatPlusPlus lol
 
Als
@sbi: Your Q title seems too complex for anyone to jump in there to peek at it
 
@Als Omniscient and omnipotent.
 
sbi
@Als :(
 
Als
@Potatoswatter: Potent yes
 
3:43 PM
Not to mention referring to him as "He" and "Q"…
 
@sbi Bounties tend to help with that.
 
Als
@sbi: You would want to make the Q title a little bit user friendly as well, Maybe a little exercise, You can check how many views it gets with the current title, abet not too many
 
sbi
@RMartinhoFernandes You can't offer a bounty unless a question is a few days old, IIRC.
 
All the msbuild stuff is defined in XML files. I guess you could browse through those
and see where the flag comes from
 
Yeah, I know :(
 
sbi
3:45 PM
@jalf Ugh. I tried to, but can't make head nor tail of it. And from what I understand they are generated, after all.
 
Greppit.
 
sbi
@Als It's four views right now, and those are probably all by you guys. :(
 
@CatPlusPlus You a frog now?
 
@sbi no, there are some static ones defining all the rules and target types and whatnot, which definitely aren't generated
 
Als
@sbi: Probably you already did it but Google
 
3:46 PM
but still a pain to read through
 
All glory to the Hypnotoad!
 
"Greppit" would be a good name for a Reddit clone.
 
@Als I bet his question is now one of the top results.
 
Als
@CatPlusPlus: Woot cat is a toad now? toad plus plus?
 
Yep, confirmed it. Second hit on google for "/d1clr:nostdlib"
 
3:47 PM
@RMartinhoFernandes it was #2 in the google search I just did :p
 
sbi
@jalf Well, it's one of them *.target files MSBuild points at, IIRC. If those aren't generated, where would they come from?
@Als Yeah. Not much luck there.
 
They're somewhere in the installation directory.
 
from Microsoft :)
 
sbi
@jalf Argh!
 
well, I suppose Microsoft might generate them, but as far as your installation is concerned ,they're just put there and then read by msbuild
 
3:48 PM
Ooh, just learned that /d1clr:nostdlib is not documented.
> Our only concern is the fact that /d1cld:nostdlib isn't "publicly" documented anywhere and whether we are at risk of losing it in a future service pack.
 
@RMartinhoFernandes that's the best kind of compiler flags
 
@Als The + stands for +oad.
 
sbi
Anyway, I really gotta go for today, I have some of my kids waiting at home. I have already disconnected from the remote machine where this happens, and can't look at it any more. If this gets more interest, I might VPn to work from home tonight.
 
> You won't lose it - in fact we probably should document it. - MSFT guy
 
@RMartinhoFernandes hah... Where's that from?
 
sbi
3:49 PM
@RMartinhoFernandes Yeah, saw that, too.
 
sbi
Well, I'm off.
afk
 
Als
@sbi: Good day
 
Is there a better IDE than Microsoft Vis?
 
@LewsTherin define "better"
 
3:53 PM
IDEs suck anyway.
 
As in easier to use, nice on the eyes, and the error messages not interrupting typing
@CatPlusPlus maybe, but what else are we to use?
 
@sbi The targets files on my machine are here: "C:\Program Files\MSBuild\Microsoft.Cpp\v4.0".
 
Text editors, duh.
 
@LewsTherin vim!
2
 
God no....
I'd stick to borland any day than use vim
Not that it is bad..I'm just not used to linux
 
3:55 PM
I use vim on Windows too.
 
I think Eclipse would be nice to use...but it don't seem to work with C++
 
Look for Eclipse CDT.
 
@RMartinhoFernandes whyyyyy?
 
Als
static_cast does no run-time checking, so presumably it requires no RTTI to be present. (Of course, this is implementation-dependent.)
Is that Correct?
 
Right.
 
Als
3:57 PM
I thought static_cast never required any RTTI
 
@RMartinhoFernandes ok thanks
 
Als
its purely compile time phenomenon
presumably seems incorrect. Its definitely
 
@LewsTherin Because vim is awesome, why else would it be?
:P
 

« first day (332 days earlier)      last day (4614 days later) »