« first day (678 days earlier)      last day (4274 days later) » 

12:00 AM
Heh.
 
Flies annoy me more than spiders
Anything that flies annoys me greatly
 
@CatPlusPlus I figured there was a typo in the title. Surely they meant "High Performance or MySQL"!
Maybe it's really a book on those two subjects.
 
Spiders are evil.
 
@CatPlusPlus Weakling.
 
Spider conspirator.
 
12:03 AM
Flies don't bother me nearly as much as spiders... creepy bastards.
 
@StephenCanon at my work, IT and Engineering are in a debate over who's budget pays for mice. :/
 
@MooingDuck Do you work in Hell?
 
@EtiennedeMartel I actually like this company, there's just a few quirks here and there
every company has people unfortunately
 
Ell
flies are bad
flying insects make.me.panic and abandon all rational though and spatial awareness
many mugs have been broken due to my flailing my arms because of a fly
 
12:19 AM
@Ell And yet you have to issue with spiders?
 
Spiders are easy to take care of since they don't fly.
 
Ell
spiders are pimps
just grab em
 
I don't kill spiders either, I just leave them alone. They don't buzz either so it doesn't annoy me
 
Ell
but flies are all disease ridden and grotesque
also spiders don't land on your face while you are trying to fall asleep
 
12:22 AM
meh, spiders
they are not my friends
 
@Ell If they're hanging over your ceiling they do.
 
Ell
yeah but they just bungee down and are like "hey dude, you okay? oh you're trying to sleep, I won't bother you in future. we cool? chill. "
whereas flies are "bzzz you trying to sleep? haha suckerz bzz bzz" (repeat)
 
Ell
12:37 AM
can you have different "streams" on twitter?
 
Want to explode your head? check out math.stackexchange.com. My head hurts.
 
I like math.
 
@Chimera I limit my exposure there
 
Oh.. Is it the formatting?
I can actually see that being a bother
 
Ell
1:01 AM
I like super user and electronic engineering
English language and cooking occasionally
Morning Mood - Edvard Greig <3
 
@MooingDuck I just don't understand most of it.
@Ell Super User is fun.
 
Ell
I go to the root user chat too
they are very friendly there
I think a good example for this chat room
 
Ell
1:29 AM
anyone here sing?
 
no, but i think this is close to singing:
:-)
 
Ell
ahh my ears
 
fascinating. My fiance called me today and said the printer doesn't work. When I got home I immediately saw why. Did you know that USB plugs fit quite snugly into an ethernet port? It's only a hair looser than a USB slot, definitely tight enough to feel like the right hole.
 
1:39 AM
@MooingDuck my mother did that once. it took some while to figure out, because unlike you i didn't see immediately what was wrong. it all looked okay.
 
That sucks.
 
I thought I'd seen it all when my sister jammed an ethernet cord into an ethernet port upsidedown. Now that one did take a lot of forcing, and destroyed the cable.
@Cheersandhth.-Alf I knew exactly where the USB ports are on my computer, I was trying to figure out what was in my ethernet port :P
 
what is difference between keane and coldplay?
 
I'm not sure what that means.
 
1:44 AM
@Rapptz pop stars
 
i just thought the linked song above sounded like coldplay, so i asked
 
I like them both, I just never thought to compare them.
 
now i find "both lead singers knew each other and both feature piano-driven Britpop rock styles (Keane was actually supposed to be called Coldplay but they gave the name to Chris Martin)."
 
That's pretty neat
 
1:47 AM
Subjective.
:P
Sounds neat.
 
2:47 AM
^ A steak.
 
3:21 AM
0
Q: Address of pointer returned by function

user1362700I try to get the address of a pointer that is returned by a class member function class Test{ ... char* d; ... char* getData(){ return d; } ... } Now I try to get the address of d (assume that *d has a valid value): Test t; char** pd = &t.getData(); This...

That's not allowed right?
&t.getData() is taking the address of an intermediate?
 
3:35 AM
ríght, but both GCC and VS have an extension for it, and you can do it portably too.
 
not suitable for work
 
I see.
Also, for some reason I got slapped by a girl yesterday for no reason whatever at the mall. Perhaps she thought I was someone else? Crazy bitches.
 
^ I think that is in the direction of nsfw, but not quite there.
 
@ApprenticeHacker lol. Post that on meta and it'll get burned in no time.
 
3:43 AM
lol
 
@RadekSlupik Dunno. Ironically, I don't. Sometimes.
 
^ I opened this in an incognito window just to be safe.
 
 
1 hour later…
5:04 AM
@Cheersandhth.-Alf Dude if that is NSFW then it'd mean Sharia has won.
 
5:52 AM
static member variables are a little annoying because they need to be initialized outside of the class scope. Therefore I often opt for function-local statics in static methods that return by reference. Yeah, I am like that.
This room seems dead.
 
The whole site kinda is right now...
Unusual for a weekday - even at this time of the day.
 
stackoverflow works fine here.
 
Dead as in: not a lot of activity
In particular this week has been signficantly slower than previous weeks.
 
Oh, I read "down" in your comment. A word which isn't there.
 
not sure if it's just a seasonal fluctuation or something else.
meta is unusually active though
 
5:54 AM
You keep good track of that. I wouldn't notice.
 
@StackedCrooked It's easy actually. I just look at how many upvotes I get...
 
@Mysticial I would guess so -- school's just starting, so I'd guess quite a few people are just getting settled in and such.
 
@StackedCrooked If you look at my rep graph, you can see the obvious weekly fluctuations. I get much fewer votes on weekends. And in particular, these last two weeks have been slower than the two before it.
 
Looking at your graph right now. Weekends are indeed dips.
August is much slower than July also.
What happened between march and July?
 
@StackedCrooked You can't count the month of July since that branch predictor question was #1 on the month hot-list the whole time. So it repcapped me almost the entire month.
 
5:58 AM
Wow.
I'd like to see the graphic untainted by rep cap.
 
@StackedCrooked After I got the Legendary badge, I pulled back and stopped answering basic questions. Then I went on vacation in May to early June. That sudden streak of repcaps starting at the end of June was all from the branch predictor question.
 
Well, you finished the big boss.
Like an RPG. Just a few smaller quests remaining :)
 
The question is no longer "hot" since it's more than a month old. But I seem to still be getting a massive number of residuals on it every day - especially weekdays.
And I'm not Jon Skeet either. I don't get a lot of views to my profile.
 
@Mysticial It's been viewed ~1.5 times as often as mine...
 
This post made me understand branch prediction. The train analogy is really helpful.
 
6:04 AM
@JerryCoffin Most of the views are from the branch predictor question itself. Where's the views to Jon Skeet's profile lead to votes on his timezone answer.
That branch predictor question is not very googleable since it doesn't have "Branch Prediction" in the title. So all the views it's getting now have to be from Stackoverflow itself.
 
@Mysticial I guess I can believe that pretty easily.
@Mysticial I'd guess there's still some activity from the links to it. Speaking of which, did you ever figure out where the third link to it was?
 
@StackedCrooked Apparently a lot of people like it. :) It seems to have one of the highest vote-to-view ratios. 1 vote for every 25 views. That's the highest I've seen for something that got a good chunk of hits from Reddit.
@JerryCoffin Nope :( I tried searching specifically for the id # of both the question and my answer. All I get are hits to reddit, hacker news (which never made front page btw), and tons of tweets and personal blogs.
I never found anything big besides, reddit and Joel's tweet.
 
@Mysticial Hmm...strange.
 
I still have to wonder how much bigger it would've been if the Hacker News submissions made front page. Both the loop and denormal questions made both Reddit and Hacker News. The branch predictor question surprisingly failed on Hacker News.
Not that it needs it...
 
There's overlap between those communities. I suspect most people on Hacker News have probably seen the question on the other sites.
 
6:13 AM
@StackedCrooked Definitely, I noticed it on the denormal float question. It made front page Hacker News nearly a month after it was asked. It was also linked to HN with another question at the same time by the same person. Both got the same number of views. But I only picked up 80 votes while the other question picked up 200.
 
@Mysticial Yeah -- it's also about 10 years late for branch prediction to qualify as news. :-)
 
@JerryCoffin I guess not for mainstream developers, given the amount of upvotes the question and answer have received.
 
The loop question made Reddit and Hacker News simultaneously on the second day. So I can't tell how many votes came from each.
 
Maybe you can act friendly with Atwood and hope he'll let you peek into so internal statistics :p
 
lol
 
6:15 AM
Maybe you can just ask him.
 
@StackedCrooked I wasn't trying to denigrate the question or answer -- just pointing out that Hacker news should really be about things that are new.
 
I got a little fanatical in the days following the branch predictor question. So put together a lot of data and timing events. There were essentially 3 sources of views during those first 48 hours:
The multicollider, reddit, and Joel's tweet.
 
What is multicollider?
The drop-down?
 
I was able to guesstimate about 200 - 400 votes from Joel's tweet. But I can't tell with any degree of certainty what proportion of the rest were from the multicollider vs. reddit.
@StackedCrooked yes
 
I just notice that multicollider has a hot questions tab. I thought it was just for notifications :p
 
6:19 AM
@StackedCrooked lol
That multicollider is heavily biased against the larger sites since they have a lot more users.
So it usually takes a LOT of votes to get an SO question to the top of that.
 
@Mysticial I'm not sure it's about number of users (though it works out about the same in the end). I suspect it's based on percentage of votes on the site, and given the number of questions on SO, it's very difficult for anything to achieve a high percentage (and yes, it takes a huge number of votes).
 
@JerryCoffin That's possible. My major criticism of the multicollider is that there is a multiplier effect by the number of answers. So those simple or open-ended questions that get like 10 answers easily top that list. More technical and narrow questions rarely do.
 
@Mysticial Yes -- the closer it is to nARQ (without getting closed) the better it's likely to do.
 
6:34 AM
@GamErix why are you even saying this? Are you are either (a) the pope or (b) not very responsible (or both, quite possibly). Also, what is up with "any condoms"? I've never required more than 1 at the same time; maybe using fewer will improve the experience for you :)
@StackedCrooked it is the only /interesting/ part, IYAM
 
@sehe That's where I find most of the interesting questions from other sites.
@Cheersandhth.-Alf wow... ow...
 
ah, my eyes!
 
@Mysticial meh. Most of the 'interesting' questions strike me as reddit-worthy, not actually worthwhile. But maybe I'm a skeptic :)
 
From what I've seen, reddit/programming definitely has different tastes from multicollider viewers.
I've seen a whole bunch of questions that topped the multicollider, but failed on reddit. The best example I can pull off the top of my head is Jon Skeet's char[] vs. String password answer.
As well as the majority of C# questions.
 
Long enough on my work screen :)
 
6:56 AM
fuck, I just tried to allocate 7.5 GB on my 8 GB machine... now it's not responsive...
 
@Mysticial Well, I might give it another shot, but... usually from the first #20 items, only 1 mildly sparks my interest
Tthat, and the titles are usually so exceptionally bad or unreadable (math.se) that it is impossible to judge from just the title and you end up clicking links just to verify. If there is one thing that I don't like, it is chasing links. That makes me rather immune to reddit/tvtropes/whatnot
@Mysticial Linux? Alt-SysRq-K terminates X, C-A-F1 for console and use pkill -9 to kill the suspect
This should be safe even on multiuser boxes, as long as you didn't share your X session (e.g. over VNC)
 
@sehe Take a look at Jeremy Bank's reddits as examples for what works on reddit.
@sehe Windows Server...
I managed to kill it. Now it's just paging the OS back in.
 
@Mysticial Good luck. Really. You might get very lucky by disconnecting peripherals
@Mysticial Ah.
 
I didn't have anything else running besides that benchmark I was running. So I could easily hard reboot it.
 
@Mysticial This is why I run without swap. That way, when the memory is full, things won't become too slow to handle, the kernel will jus OOM-kill the misbehaving process automatically. Sweet.
 
7:01 AM
Windows has too many leaky applications for me to go without swap.
 
@sehe You're eluding my sarcasm radar. I don't know what to make of your statement.
 
I usually just let the leaked memory get paged out.
 
@LucDanton It wasn't sarcasm. I just really like 'sudden death' for OOM processes.
@Mysticial Where do you find such programs? It seems, I don't use any of them
Swapping just hurts all around. The system will get unbearably slow. Often, you will be 'forced' to reboot, all to avoid killing OOM processes?
 
@sehe I see. I think I'd probably like it, too. But aren't some programs like browsers designed to make use of swap? Are you a tab-user?
 
@sehe iTunes, firefox, my overclocking tools. Granted, my 8GB Opteron box doesn't have any other purpose than to test code, so I "could" disable swap. Though the OS seems to hog about 2GB of it. So I can't use more than 6 GB without a pagefile.
 
7:03 AM
@LucDanton I am. How would it 'require' it?
 
E.g. I can only see one tab at a time and a lot of my tabs can lay 'dormant' for long periods of time. What if I'm listening to music/watching a video while compiling C++, too?
 
I have 8Gb of ram. And with several different 10-tab browsers open, email and stuff like that, I can't normally break the 2Gb barrier
@LucDanton I do this routinely, and never need any swap.
Ironically, I have had compilation of the same projects fail on Windows (due to the compiler running OOM) even with swap enabled....
Looks like somehow the compiler might be using locked pages, or something
 
Mmmh, you know what I did upgrade to 8GB of RAM. Never bothered to check usage though.
 
Pagefile thrashing on an SSD isn't that bad. It's not a death sentence like it is on an HD. On an SSD, it's always responsive enough for me to kill the offending process without a hard reset.
 
@Mysticial My SSD is too precious for that :) I run /tmp and related on tmpfs just to avoid hitting the SSD
@Mysticial Well, regardless, if it can be automatic, that always beats it IMO
 
7:08 AM
I've had bad experiences with automatic process kill by the OS.
 
(afk - going to the office ...)
 
i.e. The OS kills the process that I don't want it to kill... such as something that's been running for a few days.
 
@Mysticial Hmmm. For y-cruncher? I've learned to immunize the zfs-fuse process OOM-killer back in the day :) But that is the only case where it didn't do what I wanted
 
@sehe Not y-cruncher itself, but one of the many sub-modules that were undergoing stress-testing.
 
On linux, it is a simple flag (echo -17 > /proc/pid/oom_adj)
 
7:11 AM
I had one that seemed to need about a week to run. 5 days in, a new task I added overran the 64GB of memory and Windows killed the old process instead of the new one.
 
ow
 
That was one of the bigger motivations for why I made y-cruncher able to calculate almost exactly how much memory it needs for everything.
 
That always a sane approach. Make your application well-behaved. That way you never depend on the OS. You just depend on the sysadmin to not make mistakes :)
afk now really
 
Yeah... normally you just push memory aside since dynamic allocation "solves" it for you.
It's a complexity that you can't really push aside anymore when memory actually does become a problem...
 
Humm how to not suck at designing software?
 
7:16 AM
Not really, depends on what kind of software.
All the abstractions that C++ offers with the STL and stuff are great for the vast majority of applications.
But those same abstractions can backfire in unusual ways when you push resources to the limit.
 
@NightLifeLover Private data affords only illusion of decoupling.Class w/public virtual functions as implementation detail is more dangerous
@Mysticial Looking back at some of the code I designed I am like all "noooo did a cat horder write that?!"
 
Push memory to the limit in Java and the GC will kill you.
Push memory to the limit in C++ and you get random allocation failures. (even before you reach the limit)
That's not to say that you should avoid them. But on larger data-structures, I end up micromanaging all the memory - down to their placement in the heap.
 
Anybody know how Apache load balancing works? I feel like sticking my head in a wall.
 
@Mysticial I am not exactly sure what means with virtual functions are more dangerous. I only use them for polymorphism or interfaces.
 
@Nils There's nothing wrong with virtual functions. At least not from a memory perspective.
It gets messy when you start dealing with large STL structures.
 
7:28 AM
mornin'
 
For example, you don't know how much std::vector over-allocates. That could make your program use 70GB instead of 63GB on a machine with only 64GB.
And you don't know how much fragmentation there is in std::list or any of the set data structures.
 
@Mysticial yeah haven't thought about this. You may need a different vector like class then.
lists probably are not good for modern hardware anyways
 
But then again, how many applications actually do end up using 90% of the total memory?
 
Unless the compiler makes sure that everything is placed nicely in mem polly.llvm.org
 
morning all
 
7:33 AM
@Mysticial usually none.. unless it is something like computational science
 
I've been focusing mostly on memory so far. But there are other things which can crop up. One would be load balancing.
It's hard to estimate how long an STL operation will take sometimes. If the vector needs to be resized, or if a tree needs to be rebalanced, it can really screw things up.
That said, GC'ed languages have it even worse.
 
Maybe in your case the STL is not always suitable: open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2271.html
 
@Nils I don't use STL at all in numerical code.
 
From what I heard idSoftware does also not use the STL. I wonder if any serious gamedev does.
@Mysticial In which containers are your numbers then?
 
In that entire y-cruncher program, the only C++ that actually make sense is one or two interfaces that could be done with inheritance and maybe std::string.
@Nils Just a pointer and a few integers of meta-data.
 
7:39 AM
Never underestimate the power of simple arrays :)
 
For numbers that are on the disk, instead of a pointer to memory, it's file handle and an offset.
 
@Nils I can if I want to! :P
 
@Nils Not even that. The number objects don't even own the memory that the pointer points to.
So yeah, you can think of it as a design smell that an object doesn't own its own memory. I have my reasons for doing that.
 
@Nils they probably do in the right scenario.
IIRC, Carmack posted some "revelation" about how slow it was to iterate through a std::list.
 
it's non-intrusive or some shit. Boost had better implementation, AFAIR.
 
7:47 AM
@DeadMG node-based data-structures can really suck bad if memory is really fragmented.
 
yeah
actually, they are just really bad, when you're looking for raw iteration speed
 
I think there was an example and analysis @ www.­futurechips.­org too bad it is down right now :(
 
And then there is the issue of sorting. Do you sort the data itself, or do you just sort a bunch of pointers?
If you sort the data, then copying data is expensive. But if you sort pointers, then you will destroy memory locality.
 
8:07 AM
@Mysticial Bjarne illustrated this with a std::vector vs std::list use case in his Going native opening talk.
Vector was faster due to locality.
 
oh of course I don't have permissions to simply add myself to a mailing list. What on earth was I thinking? With that sort of power, I could add myself to a mailing list!
 
@thecoshman depends on the list, mainly. confirmation of mail address is usually required at minimum
(so you can't spam someone with list subscriptions)
 
Am I wrong when I think that the answers to this question should tell the OP what to use, instead of just pointing out why the current code is wrong?
 
this is at work... I guess I could potential add every one to all the lists... but they log this thing right?
@Default well, like so many questions he is not really asking anything other than 'what do you think?'
 
@StackedCrooked Way faster!
 
8:17 AM
@thecoshman hehe.. didn't even see that.. I just think that.. if someone else finds this.. and wants to improve their code, maybe the answers should assist with that.
instead of "don't do this."
 
go ahead and write a better answer then :)
 
@jalf unfortunately I'm not that good at C++
 
<mind boggled>
 
@Default I don't think you really need to be at C++ to help this person, it's just a case of writing clean code and 90% of the problems would go away
 
perhaps. maybe should give it a try then
 
8:22 AM
it can't hurt :)
 
Batter tries to hit the ball. Catcher catches the ball if the batter fails. Reminds me of exception handling.
 
@Default A lot of questions are like that, people seem to find it really hard to ask what they really want to ask
 
@thecoshman ah. true.
 
Guys!
 
8:29 AM
"Give example code demonstrating the difference between an unnamed namespace and a namespace that has no name"
 
class {

};

namespace {

}

// meh
probably wrong
 
the global namespace has no name!
 
@RadekSlupik Like int ::foo...?
 
8:32 AM
@sehe yes xD
 
inb4 enums
I'd hardly say it has no name. Rather, it has the empty name
Observe how the identifier is actually unambiguosly qualified by the name
2
 
the global namespace has a name
"the global namespace"
 
right. "namespace{}" contains two namespaces. two without name and one unnamed one
there are no empty names.
 
@DeadMG "That's what the name [of the song] is called" - AIW
namespace /*has no name*/ { int foo; }

namespace X { int bar; } using namespace X;
int main() { return bar; /* from unnamed namespace */ }
 
the way you denote entities has no relevance on the inherent properties of the entities themselfs
 
8:35 AM
@jalf unless I get downvotes :)
 
I know. I'm trolling the riddle
@Default Just delete if you can't fix it. Instant downvote reversal
 
@sehe: I thought the downvotes stayed
 
@sehe The riddle is a troll.
 
SO wouldn't work if it discouraged helping each other
@DeadMG As frequently is the case
 
@Default They disappear after a rep recalc.
Or so I've read.
 
8:36 AM
no the riddle shows dark corners
 
@Mechanicalsnail In my experience, they disappear immediately. It might require a recalc cycle for really old posts, perhaps
@JohannesSchaub-litb What's the difference :) Also, frequently != always
 
please show the difference between an anonymous class and and a class without name!
 
@sehe I've got a question for you, if you don't mind. There's a phrase in R.Martinho's "rule of zero", that I don't understand - copy constructor is implicitly forbidden due to user-defined move constructor. What does it really mean? That the handle itself is non-copyable?
 
@BartekBanachewicz Yes, it can only be moved from.
 
A rep recalc usually happens within 5 mins. after deleting/undeleting a post.
 
8:39 AM
@JohannesSchaub-litb please write codes for me
 
That's the case for an unique_ptr, for example.
 
@bartek it is implicitly defined as deleted
but there is a DR about changing that
 
@JohannesSchaub-litb by the only constructor being explicit or by something else? these move constructors?
 
we have multiple options. not declaring it, defining it as defaulted or defining it as deleted
 
Ah, if you create at least one copy-constructor for say, rvalue reference, compiler won't create the default one (for lvalue reference), right?
 
8:42 AM
no if you declarr a move ctor, the issue is about the copy ctor
 
Can a class use the private inner structs of a friend?
 
@Nils yes.
 
ah scratch it
it was about the moves. see issue 1402
 
@JohannesSchaub-litb errm?
 
@BartekBanachewicz but it doesn't seem to work here :(
 
Ah I have to declare D first, thx @BartekBanachewicz.
 
What do you think about mixing C and C++ code? For example using cout and printf at same function.
 
-14
Q: How to request a large no. of requests to bring the network down.?

Ashwin SinghThis is a college project. I have to develop an app which can be used to bring the network down by requesting a large no of web pages in short span of time. I have coded the program but for some reason the network does not go down and others can still use the internet. I have used 100 threads whi...

wow...
 
lol
 
9:06 AM
lol
 
@Myosotis Bad idea.
 
Sometimes, going through the moderator tools has its entertaining moments like this...
 
@RadekSlupik -.- I hoped I finally will be able to compile it under Fedora.
 
@RadekSlupik ...wut?
 
9:14 AM
@Bartek why not? it is not wrong. it works. Is there anything else necessary?)
 
@Myosotis Yes. The readability and ease of maintenance.
 
@Myosotis yet another time, please
@BartekBanachewicz "readability" - do you mean printf?
 
@Abyx I mean the consistency. Both forms are readable, but when you start to mix it all up, strange things happen
 
@Bartek @Abyx
A little sample. What is more simply
printf("a=%d b=%d c=%d",a,b,c)
or
cout << "a=" <<a <<" b="<<b<<" c="<<c<<endl
 
@Myosotis It depends.
I don't really understand what's the problem with custom ostream objects such as : cout << format("a=%d b=%d c=%d",a,b,c) << endl; (Well, I really do. They aren't much better than C printfs.)
But still, it's your choice. Just don't mix it all up.
 
9:21 AM
Bartek, may be superfluous creation of object :)
 
They're better, as in C++, and especially in C++11, they can be type-safe, unlike printf...
 
Xeo
@BartekBanachewicz boost::format?
 
@Myosotis your name change confused me :P
 
@Xeo yea, something like this. I am not advocating anything. The first question was about "using cout and printf at same function."
 
@thecoshma why? ))it is just a name. people even can change a sex :))
 
Xeo
9:24 AM
If anything, I'd do sprintf to a buffer and cout from that, but I'd not mix two output operations in the same function
Btw, wtf is up with just those closing parens? Is that some sort of emote?
 
Ok, everyone: find your ignore buttons this time
 
Xeo
I want IRC op functionality...
 
@keyur If you have a question, see Stack Overflow. If you cannot ask questions anymore, see
88
A: What can I do when getting "Sorry, we are no longer accepting questions/answers from this account"?

ArjanWhy am I getting this message? As stated clearly in the about links on every page, the Stack Exchange web sites are question and answer sites, not help forums. This implies that all posts are expected to have some value for later visitors too. To enforce that, and to prevent help vampires making...

 
Xeo
Btw, @keyur, did you not see the tag on this room?
 
9:37 AM
I have a class / object which is not copyable (cpy, cpy-assignment ctors private). Now I want to write a function which sets this object up, it should invoke the ctor, do some operations on it and then return it. This of course is not possible, because of the missing cpy-ctor.

The best sln I could come up with was something like this:

void setup(NonCpyClass& myObj) {..}

NonCpyClass myObj(3,4);
setup(myObj);
Not very elegant IMHO, is there a better sln?
 
Xeo
Move members
 
But this is C++11 exclusive, right?
 
Xeo
aye
there's also Boost.Move
For emulating it in C++03
 
Yes I need C++11 (and will get it at the new job..)
So you can have a class which is movable, but not copyable. Meaning that you can create it on the stack of a function and then return it?
 
Xeo
std::unique_ptr would be the prime example
 
9:40 AM
@Nils Why don't you call setup from the constructor? Or, pass &setup as a callable parameter to the constructor, so it can call it for you?
 
Xeo
Or just let the constructor do the setup work :D
 
We've got robot. Ohai
 
Ell
morning all
 
Rolling golem gathers no rust...
 
sbi
9:42 AM
@RadekSlupik I don't think you'd survive that for longer than a few hours.
 
@sehe The setup method is only to setup the object for testing, it does not actually belong to it.
 
@sbi You're really merciless to link and reopen conversation like this.
 
but well I could add a setup ctor.
 
sbi
@BartekBanachewicz A gorilla knows no mercy.
 
C++11 is complex, I think it takes quite a bit of work until I'm comfty with it
 
9:44 AM
@Nils You're not the only one.
 
@Nils That's why I suggest you pass it to the constructor (optionally)
 
Xeo
@Nils Just take the parts you need, it's not like you need to learn everything at once
 
sbi
@RadekSlupik And what about hurting others? And how are you ever gonna learn anything if you never get hurt? Sorry, but focusing on you not getting hurt seems awfully narrow-minded for parents. Way too narrow-minded.
@StephenCanon Note that this room is called a lounge. There's a reason for that.
 
humm and I have to wait until christmas until I get Stroustrup's book, actually even longer
If he would manage to bring it out before christmas (a preprint maybe) he could be our Santa :)
 
Oh wow, I missed a boring conversation last night. Nice.
 
sbi
9:51 AM
Still no mod dared processing my flag about reopening this answer. I might have to raise the issue on meta. Sigh. I'd really like to avoid that.
 
@sbi it's open?
 
@sbi What's so good about that answer?
 
sbi
@BartekBanachewicz If so, they not only would have processed the flag, but also would have agreed with it.
 
@sbi Good job.
 
sbi
@R.MartinhoFernandes It's the only one being Right™, while the others are (mostly) Wrong™.
 
9:53 AM
It's also quite ranty and devoid of actual content.
 
sbi
@BartekBanachewicz How come your English Grammar module is broken?
 
@sbi Prolly the amount of blood in my caffeine is too low.
 
sbi
@R.MartinhoFernandes It says "there is very little reason to use getters and setters", "getters and Setters are evil", and "why choose the smaller evil when you may just write good code without setter/getter?" That's the most correct content any answer in this whole fread has.
 
The question is not locked. What if I wrote a better answer instead?
 
@R.MartinhoFernandes the Derf Skren's answer is pretty neat.
 

« first day (678 days earlier)      last day (4274 days later) »