« first day (755 days earlier)      last day (4183 days later) » 

4:00 PM
Oh, you guys all discovered The Useless Web or what?
 
> Muench says he’s given up on a social life for now. “If I meet a girl and she Googles my name, she’ll never call back,” he says. - mobile.bloomberg.com/news/2012-11-08/…
 
1
Q: Java continue at the end of if

JamieFlowersI have some example code from a book and the author is always using an continue at the end of an if. Example: int a = 5; if(a == 5) { // some code continue; } Now for me this doesn't make any sense. Might there be some kind of quality management reasoning behind it or am I just missing some b...

 
I'm so hoping that the author actually ends all his if blocks by continue
 
People write all kinds of crap in books.
 
4:05 PM
WTF?
 
@R.MartinhoFernandes It's unnaceptable.
I mean, people are gonna take it at face value. An author has to be careful to double check what he's writing in there.
 
witness the number of crappy books out there
 
If coding style were so important to him, he'd probably be a programmer, not a guy trying to make ends meet by publishing programming books instead of programming
 
@Neil Indeed. Look at Herb Sutter or Scott Meyers. Those guys...
 
@EtiennedeMartel That was funny... no really... it might seem like this is sarcasm but I'm really laughing my ass off.. no really I am
 
4:17 PM
is there no native do-while in python?
 
while true then breaking is an alternative but there isn't an actual native solution for it
 
1
Q: C++ function returning pointer, why does this work?

user1218380So heres a simple c++ function. What it does it take an array of characters as its argument and a integer n and then creates a new character array with only n elements of the array. char * cutString(char * ch , int n){ char * p = new char[n]; int i ; for(i = 0 ; i < n ; i++) ...

Last close vote?
 
@R.MartinhoFernandes Magnets, how do they work?
 
Today I saw a magazine with "new proofs for the inexplicable" xD
 
4:28 PM
0
Q: C - Split up two byte char into two single byte chars

user1812746I have a char of value say 0xB3, and I need to split this into two separate char's. So X = 0xB and Y = 0x3. I've tried the following code: int main () { char addr = 0xB3; char *p = &addr; printf ("%c, %c\n", p[0], p[1]); //This prints ?, Y printf ("%X, %X\n", p[0]...

Is that a duplicate?
Or maybe I'm just having problems understanding what the question is...
 
There's a lot of crap going on there...
There's UB for p[1], there's the varargs promoting the shit out of everything... It's a mess.
 
Goggles on.
 
Who put infinity/infinity? More importantly.. why is it there.
 
4:44 PM
@Rapptz where?
 
Goggles.
 
what?
 
javascript: (function () { if (window.goggles && window.goggles.active) { window.goggles.stop(); } else { window.GOGGLE_SERVER='http://goggles.sneakygcr.net/page'; var scr = document.createElement('script'); scr.type = 'text/javascript'; scr.src = 'http://goggles.sneakygcr.net/bookmarklet.js?rand='+Math.random(); document.documentElement.appendChild(scr); } })();
 
Who put all this crap here ?
 
I have no idea
 
4:48 PM
Like there's Cat + Puppy 4 eva
 
@Rapptz Let me handle that. I guarantee you I'm more qualified
 
And a giant face
 
and the giant "PORN<3"
 
And a dick
 
sbi
So I found the culprit. It had nothing to do with me eliminating manually invoking delete.
 
@sbi Who ?
 
@sbi What was it?
 
@sbi Searched & destroyed, or just searched?
 
@EtiennedeMartel Yeah he does.
 
@R.MartinhoFernandes inb4 4-post spanning analysis and war story
 
4:52 PM
@EtiennedeMartel If you read his AMA you get that impression too.
 
@sehe Warning, incoming wall of text.
@kbok Yep.
 
His AMA was pretty shitty. :|
 
sbi
@sehe I changed the way the buffers are handed back from the tasks that wrote their trace messages into them, so that they were setting the length member to the actual length of the data. The thing is, this length got never set back to the actual length of the buffer, before that buffer was handed out back to another task. Eventually, the length of the buffer would be that of the shortest log messages written into it, and only nonsensical log messages would be emitted.
 
@sbi FIM. Okay. That's a bug fixed :) Time for weekend?
 
@Rapptz I think it's radek
Because elite detective skills
 
sbi
4:54 PM
@sehe Actually, I am thinking of now again incorporating my automatic memory management. :-/
 
@sbi Makes sense. I didn't know you already pulled it out
 
sbi
3 hours ago, by sbi
I have just removed the ref_counted_buffer from my code and the code still crashes. So it wasn't the buffer at all!
 
hey guys
 
How are you?
 
sbi
5:00 PM
@R.Martinho, you still at work? Do you need to leave soon? Do you have a place to waste time, if so?
 
Good buddies it seems.
I envy that :)
 
I'm not sure if sbi is making fun of me or hitting on the robot.
 
@sbi I may leave in half an hour, or just stay and read some more if there's someone still around. In any case, yes, I do have a plan for wasting that time.
@KeithLayne Neither. I hope.
 
Or both, more likely.
 
sbi
@R.MartinhoFernandes Ok. I'd really like to put this ref-counted buffer stuff back in before I leave.
 
5:03 PM
It's nothing personal, but he is not my type.
 
More into bonobos?
 
sbi
Ugh. How did this idea crop up here?
 
Okay guys, I have my quarterly dumb question to ask:
 
What idea?
 
@R.MartinhoFernandes R.Martinho x sbi
 
5:04 PM
Can't I fully specialize a struct? Not partially, right? I suck at programming.
 
A template? Yes, you can.
Man, you were not kidding. That was a dumb question.
 
Good think you knew what I meant. I suck at talking too.
GFY, robot.
 
Robots don't have genitals... yet.
 
I'm getting stupid "wrong number of template params" errors, and I don't know why.
@R.MartinhoFernandes no, you? :P
 
@KeithLayne Code?
 
5:06 PM
Probably the number of template parameters is not the right one
 
Crap. Chat failure.
and now I'm typing vi commands into chat. Great.
And why all of a sudden does g++ want me to write std::size_t instead of non-namespaced? I've been made fun of on SO before for that.
 
:set ai
^ my favourite
 
:qa!
Okay robot. Clearly I'm doing something dumb and simple. The C++ gods are punishing me for not sacrificing to them lately.
 
Don't worry. I've spent all week learning how to count all characters in a document with size 12 point.
I'm still not quite done.
 
`template<typename T>
struct robot {
T operator()() { return T(); }
};
template<>
struct robot<float> {
float operator()() { return 42.0; }
};
int main() {
robot<int> r;
robot<> r2;
}`
 
5:19 PM
Oh.
 
I still suck at this chat stuff.
 
template<typename T = float> // <--- default argument here
struct robot {
    T operator()() { return T(); }
};
template<>
struct robot<float> {
    float operator()() { return 42.0; }
};
int main() {
    robot<int> r;
    robot<> r2;
}
 
Clearly, I'm fundamentally retarded.
Then how would I do multiple specializations?
 
Sheesh, repwhoring isn't what it used to be
 
And why must you rub in the fact that I can't format code in the chat?
 
5:22 PM
@KeithLayne You seem to be confusing specializations with default arguments.
You can't possibly have two different defaults for the same argument.
 
I just need one vote and then I'll close the question :p
 
I don't want any defaults.
 
Then why did you write robot<>?
 
but I guess I do.
I want different implementation when the second arg is not the default...
But I guess you just showed me how to do that.
Maybe you could suggest a good C++ book for me to read? :P
 
@KeithLayne It may be confusing, but the primary template, while it has the default argument in it, is not used for float in this example.
 
5:24 PM
@kbok If you mean the int& foo() question, you just got an upvote from me
 
Perfect. I used the rep from my answer to pass the 3k limit so that I can vote to close as a duplicate of the function I linked in my answer.
 
@R.MartinhoFernandes I appreciate it.
 
@kbok You're evil.
 
Thanks!
 
@kbok Reminds me of answering a question on meta just to get enough rep downvote the OP.
 
5:27 PM
I should do that too, my rep on meta is still 101
 
Worth it.
 
Meta rep is so much more worthless.
@Rapptz Forever alone?
 
lol yeah
 
Should I expect T static const max = std::numeric_limits<T>::max(); to compile as a struct member with C++98?
 
user image
2
I'm sure some are familiar with this? ^
 
5:29 PM
@KeithLayne No.
 
FU again, MSVC.
 
I spend all day doing nothing.
 
Speaking of MS, those bitches flew me out to Seattle to interview for a programming job last month.
...and I didn't get it.
All I know is Linux never interviewed me and didn't give me a job. It must be better.
 
@TonyTheLion TGIF
 
5:35 PM
lol
oh gawd Slightly NSFW
 
"Asstronaut" would have been funnier.
 
Does VS10 allow local types as template arguments?
 
template<typename T>
struct foo {};

int main()
{
  struct bar {};
  foo<bar> f;
}
that compiles
 
0
Q: My First C++ Look

RuneSI am a c# programmer but today i am thinking of migrating to c++, The first thing i wonder about is that there is 2 types of projects CLR Console Application and Win32 Console Application Also what confuses me is that in Win32 i can write line to console using either printf or cout while in CLR...

Poor guy
 
lmao
 
5:46 PM
 
@TonyTheLion Wow. I just noticed that was blogspam.
The first time I saw it I shrugged it off and now I realise it's blogspam.
 
"most educated" and "state" always looks like an oxymoron to me.
 
@Rapptz blogspam?
 
Seriously, in USA there were people who believed that Russia attacked USA when they attacked Georgia...
Griwes Either provide a helpful replay or just leave. — RuneS 32 secs ago
HAHAHAHHAHAHAHAHA
 
@TonyTheLion It's a term we use when moderating subreddits when someone links their blog for views from reddit traffic for ad money.
 
5:49 PM
ah right
oh lol
 
@Griwes I don't get the title. "My First C++ Look"? What the fuck does that even mean?
 
Dunno.
 
@sbi I'm leaving. Text me or call me later.
 
sbi
6:06 PM
@R.MartinhoFernandes Ok.
How do I un-mangle GCC's C++ symbols?
What is __ZN18ref_counted_bufferD1Ev?
 
@sbi Pure unbridled evil.
 
sbi
The error message I get says this was the last symbol on the stack when the poor thing crashed.
 
@sbi c++filt is a common utility to demangle.
Just feeding the name to c++filt, or perhaps c++filt -t should be enough. See manpage for more.
 
@R.MartinhoFernandes You can update this Todo list with your feature requests. Just keep it a bit separate.
 
sbi
@LucDanton I am on Windows. I just checked, and the GCC that's embedded in this embedded dev center doesn't seem to come with c++filt. What do I do now?
 
6:13 PM
If present, <cxxabi.h> has some functions to demangle.
 
@StackedCrooked I don't think you should use Ctrl-S for saving because a lot browsers have that as a shortcut
 
@sbi, Do you have nm? It has a demangle option.
 
I'm currently playing so no c++filt on hand atm, sorry.
 
@Rapptz I know, but Google documents does it and I've never found that to be bothering.
 
sbi
@KeithLayne Yup, this I have, although only among the binaries of an earlier distribution (GCC 2.95).
 
6:15 PM
@sbi This online utility doesn't appear to be able to demangle the name.
 
c++filt wouldn't demange that one for me, what version GCC is it?
 
Hmm, searching for "sad_life.jpg" in Google Images yields @sbi's and @TonyTheLion's gravatars.
 
@EtiennedeMartel Not for me.
 
@EtiennedeMartel not here either
 
@Griwes did your comment disappear somehow?
 
6:17 PM
@KeithLayne Have you tried with both gnu and gnu-v3?
 
sbi
@LucDanton Indeed.
 
one moment..
 
(This does look like the usual mangling by GCC.)
 
yes, neither worked. Which I thought was odd, because it looks demanglable.
 
sbi
@KeithLayne It looks like I can't feed nm single symbols. :(
 
6:19 PM
The capital D after the type name suggests to me that it's the destructor for the type, but I really don't know the mangling scheme all that well.
 
no...is a linker error?
 
@sbi Can you grep through the output of nm and find the (mangled) symbol? Then compare its address with the output of nm when it demangles?
 
sbi
@KeithLayne GCC 4.1.2.
 
If not, run nm on the object file where it would be compiled?
 
sbi
@LucDanton You mean I should feed it my executable?
 
6:21 PM
If it's a template, I'm not sure where it would end up.
 
@sbi Yes.
If the debugger can't demangle the name though I don't have much hope for nm.
 
Good point.
 
sbi
@LucDanton That's from a system log message. No debugger here.
I am still fighting with nm's help to find the right params to call it...
 
@sbi, you're cross-compiling? The format options for c++filt make me wonder if gcc mangles differently on certain platforms.
 
sbi
6:23 PM
@KeithLayne That's for an old version of vxworks.
 
I don't understand what you're saying. As usual.
 
sbi
@KeithLayne I am compiling on Windows, but making executables to run on (and old version of) the OS VxWorks, on an embedded device across the room.
Anyway, nm <objfile>.o | find "__ZN18ref_counted_bufferD1Ev" comes up dry.
Ah, but there's a _ZN18ref_counted_bufferC2Ev in there!
 
@EtiennedeMartel Still nope for me.
 
_ZN18ref_counted_what_the_hell....
 
sbi
I suppose the number of underlines fluctuates, so that leaves the suffix C2Ev vs. D1Ev. Assuming that C vs. D is about ctor and dtor (there really isn't much more in there), I'll look at the destructor now.
 
6:30 PM
The amount of stuff this chat offers up to make someone lose hours and hours of their life in unproductive yet utterly satisfying simplicity is absurd.
4
Really, it's just me being mad that I fell for it for like 2 hours. :c
 
Ah, dropping one of the leading underscore yields ref_counted_buffer::~ref_counted_buffer().
 
sbi
@LucDanton Ha, I suspected as much!
Thank you very much for digging that deep!
 
@LucDanton I should have figured that one out :/
 
can I ping users in a comment?
just @username?
 
yes
 
sbi
6:40 PM
@bamboon Yes, but there are restrictions. I am sure they are explained in the FAQ.
 
6:52 PM
0
Q: Get the dot product of two vectors by functors and STL algorithms

JackHuVandyI'm learning how to use functors together with STL algorithms to calculate the dot product of two vectors. Here are my codes: template<size_t DIM> double Vector<DIM>::operator*(const Vector<DIM>& rhs) const { double dotPro = 0; std::for_each(vec, vec + DIM, std::bin...

There's no question. — chris 3 mins ago
 
@BartekBanachewicz Seems it did.
I figure that we are no longer allowed to say "RTFM" on SO...
Oh, and there is even a reopen vote for that question.
 
does MSVC2008 + MFC (no boost) have any sort of regex thing I can use?
 
Has anyone worked with a local database in VS? I can't get the mysql server to work.
 
Sometimes I think that tomalak was generally right about SO not being worth that much effort...
 

« first day (755 days earlier)      last day (4183 days later) »