« first day (403 days earlier)      last day (4542 days later) » 

3:01 PM
Heh, a truck that was carrying "sharp metal objects" lost its load on the highway. Result is 40+ cars with flat tires and highway closed.
 
lol
 
I guess those 40 cars blocked the way so that no cars could pass anymore.
Otherwise there would have been many more flat tires.
 
3:16 PM
Hey guys, if I want one and only one variable of some sort in my big C project, how do I do?
Right now I add it into one of my .h-files with

#ifndef H_FILE_NAME
#define H_FILENAME
my variable
#endif
then it says duplicate symbol
 
Declare it extern in the header.
Then define it only once in a source file.
 
@ManofOneWay And fix your include guard.
 
> Ambition is the willingness to kill the things you love and eat them in order to stay alive.
 
why this code will yield undef behavior ?
Vector<int> c;
...
for (Vector<int>::iterator i = c.begin(); i != c.end();){
  if (badValue(*i)) c.erase(i++);
  else ++i;
}
 
3:33 PM
because std::vector::erase invalidates iterators past the point of the erase?
 
Hmm I don't get it to work, should this be enough? ideone.com/IYTkH
 
@skyhisi I am assuming I don't have any live iterators from collection before entering for loop
 
@MrAnubis But you are incrementing i after deleting it
 
@skyhisi that's post increment i guess
 
No, the increment happens before erase.
But the now incremented i gets invalidated by erase.
 
3:39 PM
I'm looking at some programming puzzle. The problem is to print out all primes in a given interval.
(So far so good.)
But: the interval can have length up to 1,000,000, and the lower and upper bound can be up to 2^31
and the entire thing must be doable in less than 10 seconds
 
@MrAnubis you should iterate backwards.
 
(and that's for 150 test cases)
 
@RMartinhoFernandes aah , i missed that but if we take set instead of vector it's not undefined behavior as said by Mr.Scott meyers
 
I have a reasonably good Sieve algorithm that creates a list of the first 16M primes in 2 seconds... but for this task you need to be able to address any interval.
 
How many primes are there in [2, 2^31)?
 
3:41 PM
well, roughly log of that?
No, wait
 
@RMartinhoFernandes My STL ebook got typo again?
 
@KerrekSB Log of that is 31. I doubt it :)
 
the prime count at x is x/log x
 
Ok that makes more sense.
 
sorry, corrected
not density; total count
 
3:43 PM
So 2^26. That's too much to precompute, I assume.
 
approx 100M primes in the entire range
I think the key is to keep the sieve around
not just the list
 
These days ebooks are so un-trustable , so many typos and errors :D
 
@KerrekSB just precompute all primes at compile time with MTP :)
 
When I see "PLS HELP URGENT" in a question, I have the same reaction as when I see a "Baby On Board" sign on a car -- it makes me want to hit that car. Does that make me a bad person? :)
 
pretty much
 
3:45 PM
The baby thing? Yeah.
 
Wow, you guys are humorless.
 
totally
 
@RMartinhoFernandes you evor looked my reply in hurry :) , please have a look again chat.stackoverflow.com/transcript/message/1937006#1937006
@JohnDibling damn you , I am not :D
 
@MrAnubis As opposed to before, when they didn't exist? :)
 
:)
oh wait, now how the hell do you edit here
 
3:48 PM
@MrAnubis That's right. Sets don't invalidate any other iterators.
26
A: Iterator invalidation rules

Tomalak Geret'kalC++03 (Source: Iterator Invalidation Rules (C++03)) Insertion Sequence containers vector: all iterators and references before the point of insertion are unaffected, unless the new container size is greater than the previous capacity (in which case all iterators and references are invalidate...

 
@keithlayne I so agree :D
 
@JohnDibling Press up and edit?
 
Oh cool, didn't know you could do that.
 
@JohnDibling +1gazillion for beaker
 
haha, that is often my reaction when I'm writing code.
beaker's expression, that is.
 
3:51 PM
@RMartinhoFernandes but if I do if (badValue(*i)) c.erase(++i); // this does , why? i am confused in prefix and postfix this time i think
 
@JohnDibling I make beaker sounds
 
@keith: like, little squeaky sounds?
 
@MrAnubis With postfix, you increment and produce a copy of the old iterator. That copy is erased and gets invalidated, but the incremented i remains (assuming a set).
With prefix, you increment i, and that result is what gets passed to erase. Then erase invalidates it, and you're left with no valid iterator anymore.
 
@JohnDibling kind of a flailing squeaky scream is my recollection. My kids don't watch the muppets, so I need a refresher
 
@keith: I am LOLing imagining one of my coworkers sitting in his cube, flailing his arms and making little squeaky sounds while coding.
 
3:55 PM
@RMartinhoFernandes aah , then that should work with vector.erase(i++) too , i am so confused
 
that sounds pretty awesome @John
 
sbi
@JohnDibling You might want to read the newbie hints. :)
 
@MrAnubis No, because vector::erase invalidates both the copy and the incremented one.
 
@sbi don't make me say it...
 
Hei there. Sorry I had internet network problems
 
3:55 PM
@sbi: have you ever noticed that you say that to me almost every time I come here? :)
 
@RMartinhoFernandes aah , now got the concept :) , Thanks x Infinite (keep counting ;)
 
sbi
@JohnDibling No, I haven't. Do I? Maybe you are asking such things every time you come here?
 
@sbi: OK, I will admit something to you now. I have never read the newbie hints. I will do so now. :)
 
 
I'm using iostream and I'm declaring a "string". Now if I print all the first 10 chars of a string such as "tree" it returns me something like "t", "r", "e", "e", "upside-down question mark", "upside-down question mark", "upside-down question mark" ...
 
3:57 PM
how do you cut the word or sentence here?
 
sbi
@JohnDibling No need to admit this, we all knew anyway. :)
 
How can I detect when the string ends?
 
@JeffPigarelli Those are probably unprintable characters.
 
@Moshe, shouldn't a string end with '\0' or something?
 
@JeffPigarelli No idea, but for some reason it's reading in garbage.
 
sbi
3:58 PM
@JeffPigarelli How do you print the first ten chars of a four-char string?
6
 
very carefully
 
Is that a philosophical question?
 
@keithlayne Lol
 
UB....?
 
Please elaborate on 'declaring a "string"'.
 
3:59 PM
@RMartinhoFernandes What is... philosophy?
 
sbi
@RMartinhoFernandes You talking to me?
 
mmm... with a for?
for loop i mean
 
I have finally read the newbie hints.
 
declaring a string = std::string ourstring;
 
Are there oldie hints?
 
sbi
4:00 PM
@JeffPigarelli You really need to post code. There's many ways to deal with strings in C++ (most of which are horrible). How are we to know which one you're referring to?
 
@sbi if you search the log on "newbie hints" a certain three-letter string comes up more often than any other
 
@JohnDibling Tap dance with a cane and tophat?
 
how do I cut the word or sentence here?
 
How can i post formatted code?
 
@Moshe: LOL, for some reason my mind went to Monopoly -- the board game.
 
4:00 PM
@MrAnubis You mean this? Three dashes before and three dashes after.
 
is this working?
 
sbi
@keithlayne Why would I search for the newbie hints? I know quite well where they are.
 
`#include <iostream>
using namespace std;

void strlen(string input);

void strlen(string input) {
int i;
for (i = 0; i < 10; i++) {
cout << input[i] << endl;
}
}`
 
sbi
@JeffPigarelli Please read the newbie hints, linked from the right-hand panel. (Forgive me, @keith, but no one else seems to do this.)
 
@RMartinhoFernandes Thanks :)
 
4:01 PM
std::size_t strlen(std::string const& input) { return input.size(); }
 
sbi
#include <iostream>
using namespace std;

void strlen(string input);

void strlen(string input) {
  int i;
  for (i = 0; i < 10; i++) {
    cout << input[i] << endl;
  }
}
 
great, now I can type child porn
 
Wait, what?
void strlen? void?
 
sbi
@RMartinhoFernandes Why do you need three iterations to get something so simple right? :)
 
@sbi I pardon you
 
4:02 PM
@keithlayne That cut is overlapped on word , so you can still go to jail i guess
 
Damn you masked bonobo. I'm not perfect.
 
@RMartinhoFernandes it returns ( input = ohiwd ) 1606420272
 
sbi
Oh, I didn't know this strike trick. Does it work in questions and answers, too? In comments?
 
@JeffPigarelli I'm not sure, but I think you may have caught retardation. You should get that checked out.
 
no know it works
but if I send "this one" as input it only gets "this"...
 
4:07 PM
Ok what are you trying to do? Get the length of a string? Print a string out? I still haven't understood that part.
 
@JeffPigarelli space is one of delimiter in c++ when take input via cin >> cstring
 
Is it possible to pass a pointer to an array of known size in C? I tried the following but it doesn't work
 
Space is huge.
 
static void foo( int(*arr)[2] ) {}

int main(void)
{
  int temp[2];
  foo( temp );

  return 0;
}
 
sbi
@JeffPigarelli Taking @RMartinhoFernandes' function from above, and calling it strlen("this one") will most certainly not result in "this".
 
4:07 PM
@Praetorian I think it needs a &
 
error: argument of type "int *" is incompatible with parameter of type "int (*)[2]"
 
not sure where though
 
It does work with a reference, but I need C code
 
@Praetorian "a pointer to an array".
&temp
 
sbi
@keithlayne Instead of the * would work.
 
4:09 PM
@RMartinhoFernandes Of course! Thank you, been pulling my hair out for a few minutes
 
@sbi int(&arr)[2] ?
 
int(arr)[2] i guess
 
sbi
@keithlayne Yes, I think this should work.
 
hey everyone
 
@keithlayne Yep, that's how you'd pass a reference to a 2 element array in C++
 
4:10 PM
long time lurker, first time speaker :)
 
I remember the last time I needed to do that I nearly peed myself when I got the syntax right
2
 
@TheRarebit Welcome.
 
lol
 
(gdb) is the output i get know
 
@keithlayne yeah, I'm still not sure why that & needs to be within parentheses
 
4:11 PM
in XCode
 
@Praetorian Insane C declarator syntax.
 
operator precedence presumably, but still a little bewildering
 
@Jeff seriously, get that checked out
 
@keithlayne what?
 
sbi
@Praetorian This & isn't an operator.
 
4:12 PM
That's true, it indicates reference in this case
 
sbi
10
A: What's the meaning of * and & when applied to variable names?

sbiThe unary prefix operator &, when applied to an object, yields the address of the object: &obj. The type modifier &, when applied to a variable about to be declared, will modify the variable's type to be a reference type: int&. The same applies to *: When applied as a unary pref...

 
so it's what? a declarator?
 
@sbi They changed answer links, but didn't fix the chat yet :(
 
@Jeff I can't make sense of anything you have said.
 
sbi
@RMartinhoFernandes I was just wondering what happened there. Is there already some bugreport for this on meta, which I could upvote?
 
4:14 PM
@sbi If you post the non-shortened link (like stackoverflow.com/questions/3350626/…) it works.
@sbi Oh, haven't checked yet. Only noticed today.
 
sbi
@RMartinhoFernandes Indeed. Thanks.
 
@sbi Thanks for the link
 
sbi
@Praetorian I used the term "type modifier." I'm not sure, though, whether that's an official term.
 
I don't normally leave the cozy confines of SF chat, but I felt the need to share this.
 
That's what I need to do...find some place to talk shit on Meta
 
4:16 PM
@sbi & when in declaration of variable called type modifier? , but how does it modifies the type? it's like saying pointer asterisk
 
@keithlayne, don't worry :) I'll have to attend a C++ course the next few months at university ... I'll learn everything there :)
 
skeet skeet skeet skeet
 
sbi
@MarkM You might want to drop this in the C# and Java rooms, rather than here.
 
fair enough
 
@keithlayne That sounds nasty.
 
sbi
4:17 PM
@MarkM The fan boys are all there, you know. :)
 
@Jeff just to be clear, I was just messing with you
@RMartinhoFernandes it is totally nasty. You guys know what "skeet" means colloquially, right?
 
sbi
@MarkM Oh, and I don't think this is true, anyway. Every time I look, someone else is champion of the week/month.
 
@sbi Does Skeet answer Java questions also?
 
sbi
@Praetorian Oops. Doesn't he? I thought he did.
 
4:19 PM
@sbi I just took that screen shot from stackexchange.com/leagues
 
@keithlayne Yeah.
 
It would be awesome if they called getting a question answered by Jon Skeet being "skeeted on".
3
 
@Praetorian A lot less than C#, but yeah he does.
 
sbi
@RMartinhoFernandes And indeed, he currently is the champ in all those: stackoverflow.com/users
 
@RMartinhoFernandes Ahh, had no idea.
 
4:20 PM
Jon Skeet, Reading, United Kingdom
375k 92 1551 2762
 
@RMartinhoFernandes when I saw a dude on here with that name and that much rep, I knew it had to be a joke...but I was wrong
 
After all, he works with Java, not C#.
 
@RMartinhoFernandes He is soo much in to rep-whoring?
 
0
Q: Oneboxing for SO answers is broken

R. Martinho FernandesSeems like the short links obtained from the "link" button on answers has changed recently, and the new links (like http://stackoverflow.com/q/3350710/46642) are not considered by the oneboxing algorithm on chat. The full non-shortened links (like What's the meaning of * and & when applie...

 
How does one obtain 375K rep?
 
4:21 PM
@sbi: gimme the boats!
 
@StackedCrooked by being a pimp...of C#
 
375k rep!?
need to work on the 60 I've got :/
 
You must be new here.
 
sbi
@RMartinhoFernandes Got mine!
 
The proper expression is "Only 375k rep!?".
 
4:23 PM
lol I'll remember that for the future
 
sbi
So @jonskeet was literally answering a SO question while queuing for lunch causing @haacked to hold his plate http://t.co/wLk4rG5m
 
The amounts of rep here grows similarly to the bounties in One Piece (but in units of K instead of M).
 
It would be almost as funny if his name were Jon Singleton.
 
Doesn't that usually onebox?
 
4:27 PM
Make it a single HoT PoTato.
 
@RMartinhoFernandes Thanks, that was the HTTPS-everywhere add-on working its magic
 
What's HTPT?
 
lol
 
@CatPlusPlus Shush.
 
sbi
@CatPlusPlus HyperText Pransfer Trotocol.
 
4:29 PM
HyperText Protocol of Transference.
 
Hypnotoad Power of Trolling.
 
I'm thinking of adding a query to data.stackexchange.com entitled "how many times have I been skeeted on?"
 
You got really hooked on the guys last name, haven't you?
That came out wrong.
 
even if it weren't dirty it would be a funny word
 
evening
 
4:43 PM
http://data.stackexchange.com/stackoverflow/s/143/jon-skeet-comparison
Query to compare your score to Jon Skeet's on questions you've both answered
 
@Praetorian that's a bad proposition for most if not all I think
 
@TonyTheLion Good evening :)
 
whats new?
 
4:44 PM
oh been crazy busy
haven't even had time to go on reddit
 
Sounds painful.
 
@keithlayne lol, so true
 
@TonyTheLion what's up with you? doing what?
 
@RMartinhoFernandes actually, it's better then being bored
@MrAnubis euh, working
 
@TonyTheLion Ok, that's a good point.
 
4:45 PM
not fapping obviously :P
 
@TonyTheLion you got the job?
 
@MrAnubis got a job yea
 
@TonyTheLion congrats :)
 
sbi
4:50 PM
@TonyTheLion Which one is that?
 
He's secretive.
 
@sbi Can't tell you much. Sorry
 
He's a spy involved in some conspiracy.
You can't trust anything he says now, because it's likely a cover up.
 
hahaha
 
sbi
@TonyTheLion What?
 
4:54 PM
I'm no spy, and I'm not part of a conspiracy
 
sbi
Can you at least tell us where you now work, and what language(s) you work in?
 
See? What did I tell you? He's already trying to cover up the little bits of truth I let out.
 
@sbi yea well I'm working in C and C++
 
sbi
A government that insists on the need for a Secrecy Bill is a government with something to hide #BlackTuesday
 
He can't fool us. The truth is out there.
 
4:56 PM
@sbi oh I didn't know I was a govt, but yea
 
sbi
@TonyTheLion Of course, that's also true for individuals. :)
 
See, now he's spreading misleading ideas about being the government.
 
oh lol
 
What if he works for some company?
 
sbi
@TonyTheLion I see that you evaded my other question. For heaven's sake, can you at least tell us which country you're working in?
 
4:57 PM
You know that companies are always the bad guys.
 
@sbi the fact I'm hiding something is obvious, since I'm not telling you, I'm hiding it
@sbi UK
 
sbi
@TonyTheLion Ah, well, that's at least something to place you.
 
sbi
Anyway, cong-rats and other rodents from me to your new job! (Whatever it is...)
 
5:03 PM
@TonyTheLion is working at some company called "Torchwood"
 
@keithlayne Isn't that an anagram for Doctor Who?
 
That's in Wales.
@EtiennedeMartel Yes. It's on purpose.
 
@EtiennedeMartel let me write an anagram analysis program and I'll let you know in a week.
 
6 to 8 weeks.
 
conservatively
but it will cost you
 
5:10 PM
0
Q: inserting objects onto ostreams

seattlecppI want to be about to put a text description of a class instance onto an ostream, as in ostream << myInstance; I know how to declare an ostream inserter; ostream& operator<<(ostream&, myClass&); I want to be able to put different levels of detail to the ostream. I ...

 
sbi
@keithlayne Sounds wrong. ("Torchwood is aimed at an older audience.")
 
I think Tony is old enough.
 
@sbi Yeah, there was a sex alien in the second episode.
 
Came and went.
 
Sounds fine for Tony.
(WTF is a sex alien?)
 
5:17 PM
Well, actually it was an alien that bonded with human hosts, forced that host to have sex with another human, and absorbed the "sex energies" released during the orgasm. Usually killing the other human in the process.
 
It can't be explained. You need to watch it.
 
I think I nailed it pretty well.
 
Hee, "nailed it".
It was second after pilot.
 
Oh, it was.
 
Well, second.
 
sbi
5:18 PM
@EtiennedeMartel Whatever that means. (I have taken that sentence off Wikipedia. I have never seen Torchwood. It premiered long after I had moved out of a household with a TV in.)
 
What's TV?
 
A box where you can see sex aliens.
 
I think this "sex alien" thing is gonna get memetic soon.
@CatPlusPlus It's like a computer screen. Only it's not plugged on a computer.
 
Als
Hmm sex talk
@TonyTheLion: You sex-talk-holic guy you got a job and you didn't tell me!
Congratulations!
Oh btw a thought. I think Q's such as How do you rate yourself on C++ on a scale of 1 to 10? should be outright banned from interviews!
That Q is highly perception based relativity.
 
@Als eleven. Fo shizzle.
 
Als
5:28 PM
@keithlayne: That answer would earn you a ah okay sorry we think we hit the wrong number :_
 
I think my answer to that question varies inversely with time
Torchwood was pretty entertaining but towards the end of what I've seen they couldn't go more than a few minutes without two dudes making out
 
sbi
@keithlayne I'm confused. How can something "vary inversely"?
 
I think they should have given equal time to hot girl-on-girl action
@sbi I don't know, you guys are probably good at math or something. I thought "inverse variation" was valid. Although I should have said "varies inversely with my age"
 
@sbi I'm way more interested in girl-on-girl action anyway
 
sbi
5:33 PM
@keithlayne Why were you directing this reply to me?
 
Als
@keithlayne: Are you @TonyTheLion in disguise?
 
... it was a continuation of the first
you guys are so hard on me
boo hoo
I'm his super secret squirrel alias
 
Als
squirrel alias eh...anime....eww
 
@Als I'd say about π.
 
Als
@CatPlusPlus: What?
 
5:37 PM
Yup.
 
Secret Squirrel. No anime here.
 
Oh, hey, Doom 3 sources.
It's in C++.
 
Als
ah okay not feeling too well, I am going to call it a day, Good day guys
 
> There have been hundreds of very credible ufo sightings throughout the years. Maybe the aliens are preparing for first contact with our species. Maybe our governments secretly know about aliens, and they have met them and they have turned them against us. Maybe that is why first contact with aliens hasn`t happened.
 
Pointers. Pointers. Ctors don't use init lists. Pointers. reinterpret_cast. Init members. More pointers.
2
 
5:40 PM
Why am I reading this?
@CatPlusPlus It's a game. Made by game developers. What did you expect?
 
Everything is prefixed by id. No namespaces.
typedef struct { }. Good lord.
Oh my, I see a reference.
And templates. Woah.
 
where can you get the source?...am intrigued
 
cheers
 
typedef enum
Globuls.
 
sbi
5:52 PM
Was it xkcd who introduced the notion that the "WTF?" count is the only way to measure code quality? (Does anybody have a link?)
 
Somewhere on my way home I started thinking about emulating enums like this:
struct HTTPMethod {};
struct HTTPGet : public HTTPMethod{};
struct HTTPPost : public HTTPMethod{};
struct HTTPPut : public HTTPMethod{};
It was in a very polluted area.
 
Not xkcd.
 
sbi
@CatPlusPlus Thanks!
 
@CatPlusPlus I guess that's an indirect answer to my previous remark :)
 

« first day (403 days earlier)      last day (4542 days later) »