« first day (200 days earlier)      last day (4734 days later) » 

2:04 PM
this can only be interesting
Scott Meyers on Move Semantics, Rvalue references and perfect forwarding :)
 
@TonyTheTiger : I misread that to be " Scott Meyers on Movie Semantics, Rewind references and perfect forwarding." I guess too many movie references flying around.
 
@Xaade lol
 
2:30 PM
"Some people drink from the fountain of knowledge, others just gargle."
what are "arenas" in C++?
 
There is no such thing as arena in C++.
AFAIK.
19 hours ago, by FredOverflow
Screw it, I'm just going to publish my own new C++ standard. With black jack and hookers!
I have just read that as "...with Jack Black..."
 
@TonyTheTiger I've seen arena used with more or less the same sets of meaning as pool in the context of memory allocation.
 
@AProgrammer yes, in an article I'm reading it says "A common programming technique that uses placement new for this purpose is memory pools, sometimes also called "arenas""
 
@Tony, in this context is just mean specialized memory allocator. In other contexts, a given kind of memory allocator could be implied.
 
@AProgrammer oh thx
 
3:29 PM
@TonyTheTiger Interesting, thanks.
 
@StevenRLoomis yes, albeit somewhat scary
 
@TonyTheTiger It's the marketplace of code to bad ends
 
@StevenRLoomis yea true, its interesting that they do seem to manage to figure out how to do it though
 
3:44 PM
hi everybody
small question, i got an integer i of value 8000; further i have a const char header[] = { 0x52, 0x49, 0x46 ... }; i need to add this 8000 to it, so i could write 0x1f 0x40, but i need it reversed, 0x41, 0x1F. now i wonder, how to do this. it was quite a basic thing and i can remember classes were we did that , but its long ago.. ;)
 
@dhanke You need to arithmetically add 8000 to the integer stored in your array? Or you want to append little endian (or whatever endian it is) representation of 8000 to the end of the array?
 
i need it 2x within that array
1 as result of calculation
one time plain
 
4:03 PM
guys
 
ah @Eugene , thanks, i just need to devide by ff and i`m done after sorting... sorry . ;)
 
14
Q: String going crazy if I don't give it a little extra room. Can anyone explain what is happening here?

gAMBOOKaFirst, I'd like to say that I'm new to C / C++, I'm originally a PHP developer so I am bred to abuse variables any way I like 'em. C is a strict country, compilers don't like me here very much, I am used to breaking the rules to get things done. Anyway, this is my simple piece of code: char IP...

How did this question get 14 upvotes?
 
funny title? :)
 
also
1
A: Can this be legally be done in C++?

VJoIt is not legal, since it is not possible to specialize template functions. You could do something like this : template< typename T > struct foo { static int doSomething() {return 0;} }; template< > struct foo<int> { static int doSomething() {return 5;} };

 
@Als Stars aren't everything, you also need mushrooms and flowers!
 
cpx
4:18 PM
@FredOverflow Maybe just like how the accepted answer got twice as much :S
 
my bro and me always played that mario game as soon as we started an IE download
because when we played mario, we noticed IE displayed a higher download speed in its dialog window.
and we thought the game would speed it up xD
i even coded a program running in the background that automatically executed mario.exe once it found an IE download window exists xD
 
cpx
4:34 PM
lol
yeah it speeds up time :P
 
@FredOverflow I've stopped to consider the votes as having any meaning long ago.
 
@JohannesSchaublitb I suppose it helps when there's a correct answer to vote up instead
 
great, thanks for solving
i didn't answer myself, because he hasn't defined "Something". so I wasn't sure about what thing he's asking
 
people seemingly solved it already in comments, but I knew the answer and it wasn't posted yet; shrug
 
4:50 PM
apparently he thought "if I specialize it, then 'Something' doesn't need to be looked up, so I get away with it"
 
he's right, if he thought that
 
the type of Foo<C>() depends on C, so Something's name resolution is also dependent
 
i'm so wrong
 
I think
yeah, Foo<double> could be specialized before Bar<double> is implicitly instantiated
oh, I had Foo and Bar crossed; what I've said is true and my answer is true, but I misunderstood you
yay for meta-syntactic variables :(
 
4:53 PM
one may argue that the ODR itself doesn't apply in this case
although the ODR is unfortunately unclear here. it ignores the fact that instantiated functions don't appear "in a translation unit"
they instead appear in an instantiation unit
 
@JohannesSchaublitb I didn't bother with that pederasty; it's related, but I don't recall it's explicitly said in the ODR section
 
the ODR only applies to things multiply defined in the program in different translation units. there are separate paragraphs in clause 14 that apply to instantiated functions
 
are you in 03 or 0x?
 
and that forbid, like you said in your answer, referring to functions in a way causing instantiations before specializing them
these things happen in both 03 and 0x
the specialization should be declared in a header, but defined in .cpp files, unless they are inline of course
@FredNurk i think you nicely summed it up. therefor I spare a +1
 
"instantiation units" I only see on page 10 in 03, and it doesn't look like a useful term -- unless you're implementing "export"
 
5:00 PM
in c++03, people argued that the order of initialization of instantiated definitions of non-local objects is undefined, because their definitions don't appear in a TU. since only the order of initialization for definitions of objects of a single TU is defined.
 
yeah, that looks to be the type of useless discussion I can only see coming from using "instantiation unit"
 
scope lookup rules are such a mess; std::begin/end can't be used directly
 
Als
@ChrisBecke: V(We) = I * R(esistance) ;)
@TonyTheTiger: Thanks for your reply on my q on thread monitoring...I am still thinking about it....awaiting more suggestions...none seem to be coming up though
 
5:28 PM
@Als you're welcome. I hope it helped at least somewhat
 
Woah, +7 and -3 in one minute.
 
sbi
@CatPlusPlus That makes +4. I had minutes on SO where I made ten times that. :)
@TonyTheTiger I've seen Scott give (the first version of) this talk in Stuttgart. (Well, and I reviewed his slides before that, so I was somewhat prepared.) He's really great to have something explain to you. A natural explainer. And entertaining and funny. Makes you enjoy listening to someone all day long.
He also takes any question from the audience and tries to answer it. If he doesn't know it right away (and who would?), he researches during breaks, or in the evenings. I once got a question from him which he wrote on the plane while coming back. He had taking the email address of the guy who asked (and everybody else who was interested), and promised to answer the question.
 
@sbi Well, I'm not as good, so my answers rarely go anywhere near 10. :P
 
Any one ever did a Google trends search on C++? Here's the result: google.com/trends?q=C%2B%2B+programming
 
@Cat
whoops
 
5:43 PM
I'm not a cat.
Didn't you read my profile?
 
sbi
@CatPlusPlus In the same way that C++ isn't C?
 
@CatPlusPlus I saw that question, thought to answer it, then thought there must be some caveat...
 
@Als it is way to unclear that you have any sensible definition of what a "failure" might be.
 
@CatPlusPlus I thought "It's a TRAP!"
 
If you can define how things might fail, then ways to mitigate that might be possible
 
5:44 PM
@DougT Well, I was right at the end, and the downvoters ran away. Got closed nevertheless, so +7 it is.
 
lol
 
@sbi Yeah. Cats and I have a common subset, being lazy and sleeping a lot.
 
sbi
@ChrisBecke Whom are you talking to? @Als hasn't been here for hours.
@CatPlusPlus Are you also washing your ears by first licking your hand and then wiping that over the side of your head?
 
@sbi by hours you mean 33 minutes?
 
sbi
@ChrisBecke Oh, has he been here again? I've missed it. Sorry.
 
5:48 PM
Well, 33 minutes can be expressed in hours, too.
 
(33/60) hours
 
Hey guys, I suggested C++ 0x as a devdays topic in meta, please upvote:
http://meta.stackoverflow.com/questions/88052/what-topics-would-you-like-to-learn-at-devdays-2011/89847#89847
 
@DougT : Or the lack thereof
 
or down vote :)
 
Oh no, the topic is right.... just not expressed fully.
 
5:51 PM
Or null vo<access violation>.
 
It'd be nice to at least get to pg 1
 
That's easy
 
sbi
@DougT Haha, and because of the popularity of this room, and the notoriety of its regulars, this will get upvoted enough for them to actually include some C++11 stuff. Only then nobody will show up, because this room's popularity (and the notoriety of its inhabitants) doesn't correlate at all to C++' popularity on SO.
 
<This page left intentionally blank.> pg 1.
 
@sbi yeah, but its fun to be a contrarian
 
sbi
5:52 PM
@DougT Whom are you telling this to?
 
@DougT You're going to ruin this whatever it is to everyone, you evil person!
Welcome to the resistance!
2
 
@DougT : Oh Contra... that was a fun game.... but I wouldn't want to BE a Contrarian..... too easy to die.
 
upupdowndownleftrightleftrightbastart
 
I almost fell in this trap again: std::vector<Finger*> fingers(5, new Finger);
 
@StackedCrooked yeah that would be bad :)
 
sbi
5:57 PM
@StackedCrooked That's got naked pointers all over it! You call that a trap?! Naked pointers are big red flashing warning signs. Very hard to miss.
 
Bad?
Naked?
 
@sbi Nudity is not the problem here.
 
@Xaade Its the same raw pointer in each spot, each element points to the same thing that was new'd
@Xaade not nude
 
sbi
@CatPlusPlus Ha, I just downvoted almost all answers before C++ (except for 3 I liked too much), and that got C++ on the front page. <evil_grin/>
 
Don't point at naked pointers, it's rude!
 
sbi
5:58 PM
@StackedCrooked No, but it points right at the actual problem.
 
@sbi Wrapping them in a shared_ptr wouldn't help.
 
@StackedCrooked BTW, why not ptr_vector.
 
@DougT So you only created 1 item, and 5 array positions point to the same item?
 
@CatPlusPlus I'm not familiar with it.
 
@Xaade yup
 
6:00 PM
@CatPlusPlus probably should try it out though.
 
@sbi now that sounds really awesome :) :)
 
@Xaade new isn't run on each item, one new occurs and the result of that new goes into each location
 
sbi
@Xaade Which might be exactly what he wanted - who knows?
 
@sbi true
 
@DougT But what if you had lost all but one finger... and the stupid government made you use the same finger to do all five fingerprints on their fingerprint file.
 
sbi
6:01 PM
@TonyTheTiger Yeah, I just listened through the first two minutes of his talk and he was making everybody laugh several times. :)
 
so then do it properly and make it std::vector<finger> fingers(5);
 
@sbi Nope, I wanted a vector of 5 unique objects.\
 
sbi
@StackedCrooked Yeah, but you never said that. How would we know?
 
@sbi how has your day been?
 
Should I cut off a finger and try it out??? See what they make me do after I rob a bank.
 
6:02 PM
@sbi I somehow assumed it was obvious, apparently it wasn't. My bad :/
 
@sbi Woot! I'm gonna listen to it too :)
 
sbi
@TonyTheTiger I got a job offer. Would that make it a good day?
 
@StackedCrooked There's nothing we could do. You just didn't give us all the information. Although you didn't go around saying we weren't smart enough to figure it out.
 
sbi
@Xaade Haha!
 
@sbi Depends if it's a good Job offer
@Xaade hahahahah :)
 
6:05 PM
I finally understand what the handle meant. It's not like the intent is hidden.
 
@TonyTheTiger: I assume @sbi wouldn't have let it get that far if he weren't somewhat interested in the offer.
 
sbi
@TonyTheTiger I don't know yet. They wanted me to take a C++ test. They said I should schedule 3-5hrs, but I took a 2hrs lunch break and answered it, and then added a discussion in a comment explaining what i think was wrong with the test. :)
@StephenCanon I'm not searching desperately. Actually, I wasn't searching at all. So I just thought it can't hurt to do that as an exercise.
 
@sbi you pwn'd the test!! Nice one!!! :) :) I'm sure if I had to do it, I'd probably fail miserably.
 
sbi
@TonyTheTiger No, you hadn't. It was the common junk you see in job interviews.
 
I'm not sure that I would follow up on a job that wanted me to take a "test", no matter how curious I was.
 
6:09 PM
@sbi oh ok, I might have survived it then
 
Testing is vital to the science!
 
learned about placement new today, interesting :P
 
Interview all day long with people asking me stupid questions, sure. Test, no. At least in an interview I can tell them why their questions are stupid to their face =)
 
sbi
@TonyTheTiger Really, you would. I needed to write a function that took a C string and counted the number occurrences of a certain substring. And one that replaced all occurrences with another string. No big deal. The only tricky thing about it is the memory handling for the string replacement.
 
a nerdy pickup line "baby I wish I was your derivative so I could lie a tangent to your curves." :P
@sbi I might have to think about that twice... I think you are overrating my smartness...
 
6:11 PM
@sbi: I thought this was a C++ test?
 
sbi
@StephenCanon Yeah, really annoying. But they put those two functions into a class (MyClass), so that's probably their excuse for making it a C++ question.
I turned the thing on its feet and wrote a function templates that take any sequence, plus any other sequence, and count the occurrences using std::search(); and one taking three sequences, and replacing all occurrences of the second one in the first with the third, writing the result to an output iterator.
 
"C++: we wrap C shit in classes"
 
@FredNurk: That's the ++
 
C++ returns C and then increments.
 
@StephenCanon "C++: we wrap C shit in classes, then give you the same damn shit back because you forgot to preincrement"
 
6:15 PM
@CatPlusPlus, @FredNurk: exactly.
 
sbi
I also threw in a bit of C array size deduction using templates. :) I suppose there's a good chance they won't understand it and reject me for being overly clever. :)
 
don't mind me, I'm just peeved that std::begin/end are unusable
 
@sbi: I do like your solution.
C + template metaprogramming is a much better use of C++ than C + object-oriented class nonsense.
 
Xeo
@sbi template<class T, size_t N> void func(T (&arr)[N]) counts as overly clever?
 
@Xeo They probably don't use templates, because they're too advanced.
 
sbi
6:17 PM
@Xeo I've been working in this industry for almost 15 years, and in all that time I met less than a dozen developers whom I would trust to have a close look at this and understand what it's doing.
 
Xeo
Hi btw
 
who's "btw"? you need @btw to talk to them
 
Xeo
by the way
 
sbi
@FredNurk Whoever drank too much and is now lying BTW side.
 
good, I won't be alone drunk in the ditch later
 
sbi
6:20 PM
@TonyTheTiger Well, the only trick is that you mustn't replace in-place, because you don't know where those strings are, and whether you could write to them. Well, only in this case they were providing me with string literals, so I knew I'd invoke UB when I'd write to them. However, since on many platforms you might get away with it, they might not even know this. :( Another reason to reject my solution, then. :)
@Xeo When I kept nagging Scott to not to drop the TMP item in the 3rd edition of EC++, he forwarded me an email from another reviewer to shut me up. It said "What's a 'Singleton'?" I think he said this was one of the professional programmers AW selected (and paid) for reviewing his book.
 
@sbi: ouch.
 
sbi
@StephenCanon Yeah, that hurts, doesn't it.
Only he failed to shut me up with it. I kept nagging him, and I kept sending him examples to use to explain the matter. That turned into what's now Item 48 "Be aware of template metaprogramming". :)
Wow, 25 users logged in at GMT evening time in the middle of the week. That might not be a first, but I think it does stand out. If only you guys wouldn't confuse me with a solo entertainer! Hullo? Are you out there? Anybody listening?
 
6:39 PM
@sbi No, I'm not listening!
 
sbi
@JerryCoffin Yeah, that's what I meant when I said you're confusing me with a solo entertainer. :)
 
@sbi Your statements seem ambiguous. Do you mean I'm confusing you for a sole entertainer, or that the sole entertainer I've provided is getting you confused?
 
Listening, no. But I'm reading.
 
sbi
@JerryCoffin Ah. Well, I'm a furriner, and I mess up these things. Sorry. "For" is what I should have used.
 
I'm here, but not really here
 
6:52 PM
@sbi : Don't worry. My code failed a code review one time when I was coding in COBOL, because the senior programmer couldn't understand my loops (which had their condition at the end). I tried to explain that the loop code would occur at least once (and most often ONLY once), but they made me move the condition to the beginning.
 
sbi
@Xaade COBOL? Wow. How old are you?
 
@sbi : Only 26. But wait there's more
 
sbi
@Xaade Haha.
 
@sbi : At my company, we use COBOL as a front end, which compiles into C (using a custom compiler). This C code interfaces with an MFC C++ backend which generates the GUI from binary data (blob) built by a screen designer we wrote.
 
@Xaade I can't believe that and keep my sanity.
3
 
sbi
6:57 PM
@MartinhoFernandes AOL.
 
Yeah, Probably just blinded a lot of programmers out there.
 
Sorry, AOL? What's that?
 
@Xaade I will never complain about our codebase again...
 
@Xaade that is truely special
 
Best part... even though we code in C++, everything is a god-class..... no one here understands object oriented code...
 
6:59 PM
It's a polytheistic pantheon.
 

« first day (200 days earlier)      last day (4734 days later) »