« first day (647 days earlier)      last day (4305 days later) » 

user784668
6:05 PM
I just wrote code that unpacks a generator right after creating it.
 
user784668
itertools.product(*(opt.get_choices() for opt in options))
 
@chris at least one person downvoted it. (not me)
 
user784668
Dunno why, but that *( disturbs me.
 
It's a stunned one-eyed smiley.
 
Is there a Why should I use std::back_inserter?
 
6:10 PM
No.
 
There has to be a dupe of this somewhere...
 
lol @ flag
 
@Xeo groups.google.com/a/isocpp.org/forum/?fromgroups#!topic/… Next step: actually mailing it to the committee.
 
wth? *(v4sf*)&u[i]=*(v4sf*)&v[i]+*(v4sf*)&t[i];
talk about code you don't want to randomly find when you move in
 
OMG
that's ugly
 
6:24 PM
I think it's kinda cute
on other's code
 
Hmm new doesn't guarantee alignment for SSE.
 
@R.MartinhoFernandes robot goes big
 
@bamboon It's actually quite small.
:P
(Preemptive "that's what she said")
 
@R.MartinhoFernandes Post it to comp.std.c++.
 
@R.MartinhoFernandes looks good
 
6:25 PM
@R.MartinhoFernandes nope, that was what I asked over in the C room. you need something like posix_memalign and then placement new
 
@R.MartinhoFernandes do we have a standard way of allocating arbitrarily aligned memory yet?
 
@JerryCoffin Why? I thought they created that thing just for that.
 
@n2liquid std::aligned_storage
 
@Flexo awesome, thanks
damn, I'm really rusted
a few weeks ago I didn't even know about C11
 
Well, every time I think I'm done with this damn tool, I come back from an informal meeting with my boss with a new todo list...
 
6:28 PM
@R.MartinhoFernandes Perhaps so -- I've away from there, hanging out...somewhere else for a while.
 
@R.MartinhoFernandes If that get shot down, I quit. It's simple and useful. Well done.
 
Despite what you might think, this actually happened in Montreal.
 
@bamboon Ha, as it happens way too often, turns out it's apples to oranges.
 
@EtiennedeMartel Erm, I'm gonna kick your grenade?
 
I'm going to call these "fruit salad benchmarks".
In the function update() there is a for loop, which allocates the variable i every time it is run, and deallocates it when it goes out of scope, so it allocates some memory for the variable — Plecharts 36 secs ago
lol
 
6:31 PM
@EtiennedeMartel That guy looks like he has a whole lot of captain in him.
 
@R.MartinhoFernandes hmm, I can't follow you right now. the name is cool though
 
@bamboon The approach 2 code was doing something different. But apparently it was a copy-paste mistake.
 
The two methods differ only in the way it's allocated... Packed vs. unpacked.
 
Meh, I'm downvoting for copy-pasting disability.
 
Which at first glance looks almost exactly like the test code I threw together on the loop question. But I don't have GCC in front of me to run his code.
 
6:35 PM
@Mysticial Now. A few moments ago, approach 2 was doing placement new on the same spot for both u and v.
 
@R.MartinhoFernandes Yeah, I saw that...
 
@Mysticial Btw, unaligned SSE is slow or crash-y?
 
@R.MartinhoFernandes slow
 
Because new char[] doesn't even align properly for float.
 
depends actually
 
6:37 PM
No wait, new char does.
 
On his processor, there probably won't be a difference.
 
Lemme check again.
 
oh, crap, we really did talk about two different things
 
@R.MartinhoFernandes He says he couldn't copy+paste exactly because the shit is proprietary...
 
Yeah, saw that.
 
6:40 PM
wow...
 
So I can't verify if that code is indeed a valid SSCCE... pass
 
That's why I'll staying away from the question.
 
same...
 
I've come to the consclusion the only way to vote is based on "is it a SSCCE?"
 
it looked like something I'd be all over it at the start... but meh...
 
6:41 PM
@Mysticial how do you normally allocate memory for SSE stuff?
 
@bamboon posix_memalign
 
@bamboon I actually have my own memory allocator. But there's one that comes with the SSE intrinsics.
Here's one that's very similar to what I use:
2
A: How to obtain blocks with large alignment?

MysticialI'm not aware of a fully portable solution. But _mm_malloc() and _mm_free() seem to be supported by ICC, GCC, and MSVC. This was added as part of the aligned memory support for SSE intrinsics. Otherwise, you could implement your own fairly easily: void* my_malloc(size_t bytes,size_t align){ ...

I don't actually use _mm_malloc() since it goes directly to the heap. I have my own memory allocator underneath. So I have to wrap the alignment code on top of it manually.
 
@Mysticial oh, ok. there are indeed some versions of that here on SO
@Flexo that was what I wanted to here.
@R.MartinhoFernandes did you see the answer to your proposal?
 
@bamboon Yeah.
 
@R.MartinhoFernandes you need a better wording^^
 
6:44 PM
@bamboon there are a few others aligned_alloc and one that worked on older macs too
 
aligned_alloc is from C11, right?
@bamboon I see the point about separating the usage in the standard library to a different proposal. And yeah, that isn't intended as normative wording.
 
@R.MartinhoFernandes it pre-dated it on some systems
 
Though it should be fairly easy to specify, since it basically does nothing.
 
@R.MartinhoFernandes harder than it looks with just malloc to implement it
 
@Flexo Oh, I meant my [[deprecated]] proposal.
Ok, I'm off to dinner.
Later.
 
6:47 PM
@R.MartinhoFernandes Later, enjoy.
 
0
Q: Mac OSX 32bit or 64bit

HimalayI followed this article... http://support.apple.com/kb/HT3696 and found that Processor name: IntelCore i7 meaning it is 64 bit. However, when I do "uname -a" in terminal the result seem to be contradictory. MYMACHINE:~ himalay$ uname -a Darwin MYMACHINE 10.8.0 Darwin Kernel Version 10.8.0:...

migrate?
 
@Mysticial to askdifferent?
 
or just superuser?
 
@Flexo is the mac site really called askdifferent?
 
@bamboon yes
 
6:50 PM
no it's themacuser
 
lame
 
no it's thelameuser
2
 
@Mysticial Yes -- clearly off topic. Exactly where it belongs best may be open to question, but off-topic on SO seems clear.
@Mysticial If you're going to shorten it, do it right: it's "luser".
 
Or "theluser"
 
@Mysticial That would work too.
 
Xeo
6:59 PM
@R.MartinhoFernandes gl with that :) You already got some feedback as I see
 
Hi guys!
 
hi
 
@unNaturhal ehlo.
 
is there a way with a std::pair to rename the elements? I don't like first and second.
For example I'd like this structure to become a pair and still use the same field names..

typedef struct
{
	int sector;
	int sectorPos;
}EndPosition;
 
Implicit conversions are the only way to do that, AFAIK.
But implicit conversions are teh evilzz.
 
7:08 PM
So then perhaps I just keep this a standard struct?
Or is there a better C++ way to do it?
 
union foo {
  std::pair<int, int> bar;
  struct {
    int sector, sectorPos;
  };
}; // :P
Oh and you don't need typedef struct in C++.
 
If you really want it as a pair, one way would be to store a std::pair in your class and make sector() access first and sectorPos() access second.
Seems a bit unnecessary, though.
 
Functional programming! :>
 
@chris Nah, I don't need a pair... just wondering what the C++ way is... probably in this case just keep it a struct?
 
using Sector = std::pair<int, int>;
int sector(Sector const& s) { return s.first; }
int sectorPos(Sector const& s) { return s.second; }
 
7:12 PM
That works too. Not sure what else you can do.
 
@JimNorton Sure, but remove the typedef, please.
 
@RadekSlupik Yeah that's nice, but probably not necessary..
@EtiennedeMartel Will do. What is wrong with the typedef? Is it a style thing, or will it break in C++?
 
It's C.
 
And move the name: struct EndPosition{/*...*/};
Less typing and everything too.
 
@RadekSlupik Noo!
 
7:13 PM
@JimNorton It's unecessarily verbose.
 
typedef struct { … } foo; // C
struct foo { … }; // C++
 
What if pair reorders the members for optimal layout?
Wait, pair doesn't need that.
 
Well, you'd be screwed.
 
I'm not sure about pair, but I'm sure a tuple of PODs is not POD.
 
using foo = struct { … };
 
7:14 PM
27
Q: Is gcc std::unordered_map implementation slow? If so - why?

Markus PilmanWe are developing a highly performance critical software in C++. There we need a concurrent hash map and implemented one. So we wrote a benchmark to figure out, how much slower our concurrent hash map is compared with std::unordered_map. But: std::unordered_map seems to be incredibly slow... So t...

Well, well.
 
Isn't std::pair required to be class { public: T first; U second; };?
(ignoring its member functions, ctors and dtors)
 
@EtiennedeMartel ok thanks
 
@RadekSlupik It has ctors.
 
@EtiennedeMartel You are verbose!
Verbosity is always unnecessary.
 
@RadekSlupik I'm so much more.
 
7:17 PM
How much more?
 
Wow, that's much more!
 
It’s greater than π, implying awesomeness.
 
Ugh. Luchian is on the prowl again. Taking all the C++ questions.
 
7:21 PM
Be glad, you don't have to answer them anymore.
 
@Drise His tendency to rush to answer crappy questions kinda labels him as a repwhore in my opinion.
 
@EtiennedeMartel He is, but he also knows what's up.
 
yeah, that jerk, having the temerity to answer questions on a Q&A site!
 
That shouldn't be allowed.
 
Excuse me guys.. Could someone help me to make a choice? I have to learn to use a UI library, and I'm undecided between GTK+ and Qt. I already googled about it, and already red the posts in this site, but some info are dated, some other are incomplete.. So I ask: on which of the two is better to invest time to learn it?
 
7:25 PM
@EtiennedeMartel What is wrong with being a repwhore if you provide good answers?
 
@unNaturhal, probably qt, haven't used either, though
 
@JimNorton It's when you answer bad questions that it becomes a problem.
Because then it's like you don't care about making SO a better place, all you care about is making rep.
 
@unNaturhal qt is good and quite popular, but GTK+ is also popular. If you want to use C++ GTKmm exists which is a C++ GTK library.
@unNaturhal I believe qt has much better documentation..... I'd choose it over GTK
@EtiennedeMartel Makes sense.
 
@JimNorton I know this.
@JimNorton You'd chose it because of the better documentation?
 
Qt is better, as long as you can live with the whole "set of non standard extensions over C++" approach.
 
7:28 PM
@unNaturhal Yes I would..
 
@EtiennedeMartel What do you mean?
 
@unNaturhal Because trying to learn GTK+ which has terrible documentation is a real pain in my ass!
 
Why do all the questions get tagged with and/or ?
 
man, shitty internet connection won't let me watch a movie without seeing "Buffering..." ever 5 fucking minutes
 
@JimNorton LOL! I understand xD
 
7:30 PM
Now I'm pissed
 
@unNaturhal Does licensing of the libraries matter to you? Because I believe QT is more restrictive than GTK in that regard.
@TonyTheLion Oh no.. why for?
 
@unNaturhal Qt has a bunch of non standard extensions to C++ (slots, signals, meta object system, etc.). That's why you need to moc Qt files. It also has its own library that is large enough to fully replace the standard C++ library. It even has its own build system (qmake)!
 
56 secs ago, by Tony The Lion
man, shitty internet connection won't let me watch a movie without seeing "Buffering..." ever 5 fucking minutes
 
@JimNorton It's LGPL now.
 
@TonyTheLion Oh I feel your pain.
 
7:31 PM
In practice, Qt is not really a C++ framework, it's a proprietary platform like Java or .NET that just happens to use something that feels a lot like C++.
 
@JimNorton :)
 
@JimNorton I dunno.. Commercial, I think
 
@EtiennedeMartel Oh that's good to hear.
 
@EtiennedeMartel And this is a better thing? Does not seem to..
 
@unNaturhal It means it's much harder to switch from C++ to another lib later on than it would be with any other UI library.
(But not that hard, as long as you wrap everything beforehand)
 
7:36 PM
@EtiennedeMartel Mmmmh.. You mean that if one day Qt will fail, it could be harder to learn to use another UI lib?
 
If I posted some C code in a SO question tagged C++ asking how best to design the classes would this be a legitimate good question? I'm kind of struggling figuring out how best to represent the C code as C++ classes/objects... OO design I guess it's called.
 
How does Luchian not have the Legendary badge yet?
 
@unNaturhal No, I mean that if you want to stop using Qt in your codebase, well, good luck with that.
@Mysticial He's not efficient enough in his repwhoring.
@JimNorton If you have code that's essentially a struct with a bunch of functions, then it's easy to make a class out of that.
Remember that OO isn't a silver bullet and as such you shouldn't try to shoehorn classes everywhere just for the sake of being "object oriented".
 
Jim...you could privately inherit from pair, then create accessor functions (inlined) but you would probably want to make const & non-const versions or you wouldn't be able to set the value.
 
@EtiennedeMartel An this is a very good reason to choose GTK+.. But, other than GTK+ and Qt, there isn't nothing else good enough to deserve to be learned?
 
7:39 PM
@unNaturhal Personnally I don't use C++ for GUIs. When I need a GUI, I use C# and WPF. I never used GTK.
 
Qt and GTK both suck. We need a modern C++ UI framework, as in, using modern C++. That has nothing to do with C.
@EtiennedeMartel no! WPF bad for Mono.
 
@keith.layne Who uses Mono?
 
@EtiennedeMartel But I immagine that it is not cross-platform right?
 
@unNaturhal Well, .NET is mostly Windows only, so...
 
@EtiennedeMartel my mom.
 
7:40 PM
@EtiennedeMartel Got it. Would the question be legitimate though?
 
@JimNorton A good question is always legit.
 
@EtiennedeMartel Would that question be a good one? :-)
 
@unNaturhal Always ask yourself if you really need cross platform compatibility, though.
@JimNorton Sure. Be careful though: if it's too vague, it might get closed as NARQ. If it's too precise, it might be closed as "too localized".
 
@EtiennedeMartel Not right now, but in the future, who knows?
 
@EtiennedeMartel Ok great. Thanks again for the advice.
@EtiennedeMartel Ok I will use the example code as a way to get better at OO design... Should be in the middle of precise and vaque..
 
7:43 PM
@unNaturhal The future is shaping itself to be quite platform dependant with all those mobile platforms not being compatible with each other.
 
@EtiennedeMartel Not to argue the point, but it does seem possible (at least to me) that part of it is simply trying to help out the person asking the question, even if they may not have asked it particularly well.
 
@EtiennedeMartel Yeah, I was just talking of mobile world. Qt works on Android (I don't care about iOS), and I think that GTK+ works well too..
 
I literally did a double-take when I saw this:

switch(playerNum)
case 1: return(player1);break;
case 2: return(player2);break;
case 3: return(player3);break;
case 4: return(player4);break;
case 5: return(player5);break;
case 6: return(player6);break;
case 7: return(player7);break;
case 8: return(player8);break;
case 9: return(player9);break;
case 10: return(player10);break;
 
haha
I work with an army of guys who do code everything like that
absolutely no concept of oop
 
@chris An array might fix that.
 
7:49 PM
This cries out for an array. — chris 9 mins ago
 
@JustinMeiners Fortran had no concept of OOP, but it could still do that much more reasonably.
 
@JerryCoffin your right, I guess they just have no concept of reusability, or modularity
 
brhhuo4thth
I hate my job
x____x
@chris manual loop unroll :DD I say the programmer must've been of the finest kind ;)
that guy should work for Boost Preprocessor
 
@n2liquid ...except that it doesn't seem to be happening in a loop...
 
(QT Creator it's really heeeeeeavy..)
 
7:54 PM
@JerryCoffin of course, 'cause it's unrolled?
oh wait, never mind
:4658190 yeah, never mind, never mind, lol
it wouldn't call for a loop, an array subscript would do xP~ silly me
 
Used the maximum 40 votes in a day Okay, I've maxed my question/answer vote count, and comment vote count today. What more do I need to do? That badge seems to not want me to get it.
 
And the hits just keep on coming. Gotta love this one:
0
Q: C++ How to pass a variable char array from one function to another

MichaelI have a question regarding passing a variable that is a char array from one function into the next. Here are the samples of code involved: int main( int argc, char** argv ) { int value = 0; int nCounter = 0; FILE* fIn = NULL; char * sLine = new char[MAX_FILENAME_SIZE]; char * sFileName = new...

strncpy, while (!feof(whatever)), and the icing on the cake: strcat(something, "\0");
 
@JerryCoffin, C with new
 
@chris Not just C with new -- really bad C with`new`.
 
@JerryCoffin, Heh, yeah.
Hey can we add a tag?
Doesn't fit as a tag, but it'd look cool in all the comments I could make with that.
 
8:03 PM
evening lounge
 
@chris Pretty sure you can add it, but not sure how popular it'd be on, say, meta.
@nightcracker This is the afternoon lounge. The evening lounge is down the hall on the left, across from the smoking lounge.
 
-1
Q: Object Oriented Design - Convert C Application to C++

Jim NortonI'm starting the process of learning C++ and object oriented design. I have a fairly small C application that I'm converting to C++. I'm looking for some tips on how the application below might be be organized as objects/classes. I would appreciate answers that will teach me some approaches that ...

Crap .. already down voted. With no comment as to why.
 
@JerryCoffin, I can see how that would work: Meta: Can I add this tag? Reply: .
 
@JimNorton It's a fucking huge lump of code. That might be the reason.
 
@EtiennedeMartel Well, it needs to be shown to analyze it right?
What code should I trim out?
 
8:10 PM
All of it; it's C.
 
@RadekSlupik Hehehe
Who can see the up/down votes? Has it had just 2 down votes?
 
@JimNorton Are you familiar with SSCCEs?
 
@EtiennedeMartel No not at this time.
 
@JimNorton, +0/-2
 
8:13 PM
I loved getting that privilege lol
 
Jim
 
@EtiennedeMartel Yes I am, but in this case I'm not show casing a problem. I'm asking about how to design this using OOP techniques... shouldn't all the code be needed?
Hello Dead/
 
your code sample is quite a bit larger than we usually accept
and secondly
you have to start by removing immediately all your global variables
nobody can see the patterns in spaghetti
 
@JimNorton, I very often see things of How do I convert from language X to language Y get dved and/or closed.
 
and thirdly
 
8:14 PM
It's not exactly the same, but it is kind of close.
 
@Jim
 
you can strip all the function bodies
just name the other functions and structures they reference
 
@JimNorton maybe you should rephrase your question like "What are the known/common techniques for converting procedural code to object-oriented code" or something?
 
oh, and fourthly
 
Oh, I saw a comment for codereview, do they accept huge walls like that?
 
8:16 PM
the most obvious way to begin is by isolating GTK
@chris I think so. But he doesn't want a review.
 
@DeadMG, Wow, I just thought they didn't like those either. It wasn't overly question-specific.
 
@chris Much more accepting of big chunks of code, and of the idea that you don't have quite so specific a question to ask -- but translation really isn't what's covered there.
 
I reduced the amount of code
Is that more reasonable?
 
that's better
 
@DeadMG I can't as this is going to be integrated at a later time into a larger GTK+ application.
 
8:20 PM
@JimNorton Nobody else is going to care if you, personally, wrap the GTK+ APIs
it's gonna be a tad of a mess to have a half-OO, half-procedural application
 
@JerryCoffin, lol I pretty much copied your comment into an edit of mine and then realized.
@JimNorton, There are still a lot of things irrelevant to OO in your code, like most of the function bodies.
 
@DeadMG Actually the application this is being integrated into has mostly already encapsulated the GTK stuff.
@chris Ok will do some more trimming
 
oh, ok
 
Does anyone know why comment votes require a refresh, but question/answer votes don't?
 
@chris The auto-refreshes were only implemented recently. They started with activity on questions. Then the rep # on the top of the page. And then votes.
I guess they never bothered to extend it to comment upvotes or the favorited counted.
 
8:32 PM
@Mysticial, That makes sense, thanks.
 
Though favorites are rare. Most questions get no favorites. It's only the extremely popular questions do favorites come in fast enough to warrant a live-update.
 
@chris Does this look better now?
-2
Q: Object Oriented Design - Convert C Application to C++

Jim NortonI'm starting the process of learning C++ and object oriented design. I have a fairly small C application that I'm converting to C++. I'm looking for some tips on how the application below might be be organized as objects/classes. I would appreciate answers that will teach me some approaches that ...

 
@Mysticial, I hate to say it, but I've never favourited any. What does it do? I haven't seen anything on that yet.
@JimNorton, That's certainly much more addressable than before.
 
@chris It shows up on your "favorites" tag and will notify you of any activity on that question.
But most users (like me) actually put their favorite questions on there.
 
Those down votes are killing me.
Probably should have reduced the code example before posting the question.
 
8:36 PM
So Stellar Question is arguably the most difficult reattainable badge to get since getting favorites is much harder than votes.
 
@Mysticial, I guessed at the notification. I didn't know it actually went somewhere. I'll have to start putting on the popular dupes.
 
I've seen some moderators favorite a lot of the extremely popular questions - since they tend to need "more protection".
 
So I here ruby mentioned a lot in this room, so while I'm here...
I need to make a standalone version of redmine so I can just ftp it up to the server.. what should I do about gem dependencies?
 
So now is that a more acceptable question?
-2
Q: Object Oriented Design - Convert C Application to C++

Jim NortonI'm starting the process of learning C++ and object oriented design. What are the known/common techniques for converting procedural code to object-oriented code? What design choices make sense for the following code? typedef struct { int sector; int sectorPos; }EndPosition; typedef stru...

 
I'm deep.
 
8:43 PM
Gave you a +1, since you clearly put a lot of effort to dig it out of its hole.
 
@JimNorton I think so. I agree with Mystical. You've also got a +4-1 spread
 
@Mysticial Thank you.
 
Imagine how hard it is for other people who don't have support from a chatroom...
Which I think is one of the weaknesses of the SO system.
 
@Mysticial That's why we laugh at them.
 
I agree
 
8:44 PM
I wish private messaging was possible.
 
^^^^^^this
put it on the notification list and put in the option to start an im
 
There is an occasion where I need to speak directly with someone.
@chris Want to go to meta? Or has this been beaten to death?
 
@Drise Me too
 
@Drise, Has it been suggested?
 
@chris Dunno.
 
8:45 PM
@Mysticial Very nice... thanks all.
 
130
Q: Any way to send a personal message to another user?

a_m0dThere has been quite a few times that I wished I could send a message to another user on SO - not ask a question for everyone to see, but just a short message informing them of something or requesting them to do something. Are there any plans to allow this to happen in the future? Related: Ho...

 
It's very hard for new users to improve questions without it sometimes, though.
 
> On the flip side, if you want to provide a way for people to contact you, leave contact information in your user profile.
 
I have it on my GitHub. People need to click at least two links to get to it from my profile page.
 
8:48 PM
"Yer momma so fat she overflows the stack!"
2
 
Netbeans 7.2 is out! I found a reason to feel sad!
 
Shut up, my momma isn't fat.
 
I think the puppy is better at the your mom jokes.
 
@EtiennedeMartel, Still, e-mail or whatever? It's so inconvenient, especially that you have to leave the site to do it.
 
I remember one being about solar masses... don't remember when though.
 
8:49 PM
No, her yo momma's ass is just so big you need a map to find her asshole
 
I dislike the "Please avoid extended discussion. Do you want to start a chat room?" That really bothers me. Because sometimes an answerer and I work together and collaborate.
 
@Tony why would I want to find yo momma's asshole?
 
donno
 
Apr 23 at 16:27, by DeadMG
is x the weight of your mother in solar masses?
 
8:50 PM
@Drise Maybe that piratepad.net thing we saw yesterday could somehow be implemented/integrated into SO?
 
weight in solar masses?
 
Or the concept at least
 
@JimNorton There was a better one.
 
@RadekSlupik Lol yes, weight and mass are not the same
@Drise ?
 
The puppy fails at physics.
 
8:52 PM
9
Q: "size" is to "resize" as "capacity" is to [?]

MehrdadIs there a (different) word that has the same relationship to "capacity" as "resize" has to "size"?

I really want to say reserve.
 
recapacitize
 
reallocate
 
How many solar masses would your mom be if she had the density of water and the diameter of Saturn's orbit?
 
Oh, never mind, found it in the question's comments lol
 
@mystical ask WolframAlpha
 
8:54 PM
@JimNorton typewith.me
 
MyStiQaL
 
No, if it's your poverty, you're going to have to do your bit from your end.
That's what Cleverbot said, @Mysticial, it must be right.
 
Cleverbot?
 
@Drise Oh nice
 
omg did I get starred for that yo momma joke? That wasn't even mine, hence the quotes.
 
8:58 PM
@chris I thought it was quite funny in the original document.
 
I failed the Turing test. :(
 

« first day (647 days earlier)      last day (4305 days later) »