« first day (646 days earlier)      last day (4310 days later) » 

4:00 PM
@Mysticial, Did you hear? I found a shiny Swinub last night LOL
 
@JimNorton using unique_ptr will automagically forbid the copy for you.
 
@JimNorton Do you want CairoImage a = b; to compile or not?
 
@chris wow... right after we hammered over it all night. :)
 
@chris I saw that shit and wondered what language you were speaking
 
@keith.layne lol
 
4:00 PM
You're already past the 7th gym?
 
@JimNorton Hand-rolling or finding some kind of deep-copying smart pointer is also an option. std::shared_ptr, too, sometimes (for select cases though).
 
@JimNorton Correct, but the second option enforces the first. Although it doesn't hurt to non-automagically forbid it (for code readability purposes)
 
@FredOverflow No, I won't be assigning one image to another.
 
chris
3:17 AM
OMG A SHINY SWINUB
first try caught ftw
 
@JimNorton forbid copying then
 
4:01 PM
@JimNorton Then use unique_ptr members instead of raw pointer members, done.
 
not sure how to quote things tbh
 
Just link to them.
 
@FredOverflow Ok I will read up on unique_ptr....
 
Pokemon, dafuq?
 
@LucDanton several libraries have a value_ptr
 
4:02 PM
8
A: Can someone please explain move semantics to me?

FredOverflowMy first answer was an extremely simplified introduction to move semantics, and many details were left out on purpose to keep it simple. However, there is a lot more to move semantics, and I thought it was time for a second answer to fill the gaps. The first answer is already quite old, and it di...

@MooingDuck He doesn't want copies.
 
@FredOverflow he thinks he doesn't want them now.
 
@JimNorton Of course, you will need a custom deleter that does not delete the pointer but instead calls the appropriate release function. But since I've never done this before, I'll leave the explanation to somebody else.
 
@MooingDuck No I'm sure I won't be assigning one CairoImage to another
 
@FredOverflow Is that what you'd do when using a smart pointer for i.e. a lock?
 
ack! And I thought this was such a simple example... But no, because I have members that are pointers..
 
4:04 PM
@keith.layne Ewww.
 
So, I named my Goblin Geometry. My Worgen is called Functor and the third one is called Monad.
 
@R.MartinhoFernandes ???
 
@keith.layne unique_lock FTW.
 
no RAII for that?
where do I find that?
 
Ok, NOW I'm going to read about rule of three.. brb
 
4:05 PM
@JimNorton just start with a unique_ptr. oh, after you read the rule of 3
 
@keith.layne <mutex>, I think.
 
wheels?
 
Rule of Three. No love for move semantics? :$
 
@DomagojPandža the love was moved
temporary love
 
@DomagojPandža You need three out of five now that there's moves. But still only need three.
 
4:06 PM
@MooingDuck ok will do
 
22 mins ago, by Domagoj Pandža
@R.MartinhoFernandes Rule of 4.5!
 
@MooingDuck True, but it would be nice to drive formal recognition.
I sell it as 4.5
 
0
Q: 3d array allocation by void function

user1541328I obtain a Segmentation Fault when i=0 and j=2; But I don't know why ! Could you help me ? That's my function : void allocationdynamiquetableautroisdimdentier(int**** Matrice,int nbniveau, int nbligne, int nbcolonne) { int i,j; *Matrice=(int***) malloc (sizeof(int**)*nbniveau); for (i=...

3-star programmer XD
 
@MooingDuck Not writing special members altogether should really become the new default recommendation rather than those rules of however much.
2
 
@Mysticial Worst kind. Memory fragmentation is off the charts.
 
4:08 PM
@LucDanton eh, I think now that we have moves, I think you're right
 
allocationdynamiquetableautroisdimdentier
 
int**** Matrice
 
@keith.layne Actually, the rule of 3.873 (geometric mean instead of arithmetic).
 
rule of 3.14159 (my logic)
 
4:09 PM
I got nothin
 
I'm late, right?
 
@R.MartinhoFernandes Sexual.
 
@Mysticial Oh gawd, that title.
 
@R.MartinhoFernandes Needs a sad face somewhere
 
@chris You about 9 trillion, 999 billion, 999 million, 999 thousand, 996 digits short of impressing at least some participants here.
 
4:10 PM
lol
 
aww i only know 50
 
@Mysticial Four star programmer.
@JerryCoffin hehe.
 
@Mysticial there really ought to be a gcc warning for "are you nuts? there's got to be a better solution" when you get past **
16
 
meh, I don't know how you can think that a four level pointer is going to help you with anything?
 
There was so much hope back then.
@Flexo Very true.
 
4:12 PM
@DomagojPandža yea, now all hope is gone.
 
@chris In the days of my bored and mis-spent youth, I knew 100, but I doubt I could manage much more than about 50 with any certainty any more either.
 
I got bored one summer before I started programming. That's my reason.
 
when the heck do you decide to learn PI to 100 digits after the decimal?
is it like, one morning you get up and think "oh, I shall learn PI to 100 digits today"
for lulz
 
it's good for scaring people off
 
-1
Q: Wikipedia: Creating a centralized access point for propriety databases/resources

OcaasiThe problem: Many proprietary research databases have donated free access to select Wikipedia editors (Credo Reference, HighBeam Research, JSTOR). Managing separate account distribution for each service doesn't scale well. The idea: Centralize access to these separate resources behind a singl...

 
4:14 PM
@TonyTheLion I think I thought it made me smart
I've since forgotten most of what I memorized
 
@JerryCoffin I had to memorize that for praxe.
 
@TonyTheLion I was bored at school, especially during literature classes... 3.14159265358979323846264338... But I won't be that guy and continue. :Đ
 
Close votes please. If that wasn't implied.
 
I'm sure @Mysticial knows way more than any of us
 
4:16 PM
@TonyTheLion I can only recite about 10 digits.
 
Actually, I think that Mystical didn't go beyond 10. Beyond comparison, he probably got too sick of it to memorize. :Đ
 
the irony
 
Hahahahah! I am good at profiling.
 
@TonyTheLion Not sure what difference it makes, but about 1980, if memory serves.
 
However...
 
4:16 PM
calculates Pi to 10 trillion digits, only knows Pi to 10 digits
 
@DomagojPandža really? In my experience most programmers have 12-14 (accuracy of float)
 
I can easily recognize the last 4 digits leading up to the millionth, 25 millionth, billionth... etc
because those are my most common test sizes.
 
@Mysticial Interesting.
 
heh, 3.1415926535 something something something 3629
 
@DomagojPandža It's Mystic - i - al.
 
4:18 PM
Can we get that closed please? It's really bothering me.
 
@Mysticial Okay then - 8933
 
@R.MartinhoFernandes Hah, I just noticed.
Damn, I could've sworn it was Mystical.
 
@chris yeah, I can't recite them off the top of my head, but I recognize them well enough to know whether the computation was correct.
 
@thecosh got me wanting to be dyslexic now.
 
@Neil Doesn't look like it's one of my test sizes.
 
4:19 PM
1234?
 
@Mysticial Then I don't think I know what you mean by test size
 
Oh BTW, I bought Counter-Strike Source over the weekend... I'm immensely enjoying playing CS again!
 
@R.MartinhoFernandes The chances for that must be way into after the 1000th digit.
 
I sort of grok the rule of three and why it;s important.. now to figure out how to use unique_ptr
 
Hell, even further.
 
4:20 PM
@JimNorton I hated that game. It always seemed like people were always cheating
 
Sort of grok. Nice oxymoron.
 
@Neil Like for example: My most common test size is 25 million digits. 4322 are the last 4 digits leading up to the 25 millionth.
 
@chris Well ok, I sort of partially grok.... :-)
 
1592 for 100 millionth
 
@Mysticial Ah, I see
That sounded more impressive before then
 
4:21 PM
@JimNorton Simple, same as any other classic pointer, besides the need to think about memory. std::unique_ptr<T> blah(new T) - You can't transfer ownership* and fuck it up in any way - and after it goes out of scope, it's bye-bye for it. *One word, move.
 
The program will output the last 100 digits that it computes. And I just quickly glance at the last 4 digits to see if it's correct.
Once you do it enough times with the same sizes, you remember them.
 
The non-obvious thing about std::unique_ptr is the lack of make_unique -- and explaining why we'd need one takes some detour in non-obvious territory, too.
 
Maybe not the numbers themselves, but at least the shape of the last 4 digits - in other words, know them well enough to recognize: correct from incorrect
 
but does he need something to call the cairo cleanup routines when it goes out of scope?
 
@LucDanton obviously needs some explanation :P
 
4:22 PM
GOTW 102.
 
@Mysticial You'd be popular at a talent show
 
Thanks all, I will implement the unique_ptr and get back to you... might have questions along the way.
 
It leaves me wondering how nobody didn't attempt to calculate pi in a more official capacity.
Those supercomputers could crunch it nicely. Even use our own MysticIal's code as a foundation.
 
Nobody didn't? I didn't...
 
@DomagojPandža where does it end though? It's a never ending number....
 
4:25 PM
@DomagojPandža It's just for show. Won't lead to anything. (Or will it? We should try and find out!)
 
@TonyTheLion Record breaking, basically. Bragging rights.
 
@DomagojPandža Many years ago, for his bacholer's thesis, my brother wrote a history of computing Pi to a million places (which was about as far as anybody had done at the time).
 
Usually, < 50 is all the precision you need.
 
@DomagojPandža In Mystical's case, more like computer-breaking
 
@keith.layne He probably made an HDD graveyard. :Đ
 
4:26 PM
Are the move copy constructor and assignment operator implicit in custom classes?
 
when we have 256 core CPU's we'll be racing to calculate Pi to as many digits as possible
 
To all those who valiantly fought and fell.
 
or when we have multiple GPU's in our machines by default
@ManofOneWay the compiler creates them if you don't
but they are just the default ones, so no deep copy anything
if you have pointer members
 
@TonyTheLion It'll be a memory bottleneck before that happens. Even beyond 16 cores, the program doesn't scale well.
 
4:28 PM
@Mysticial And memory is up shit's creek lately.
 
Pi is the number that challenge latest CPU.. other than that, why the hell should we use 4billions decimals ?
 
The program itself is able to scale almost perfectly to unlimited cores. However, it requires fast uniform memory.
 
for funz
 
unique_ptr<cairo_surface_t> m_surface;
cairo_surface_t *m_surface; // Current image surface

Is the first line creating a unique pointer properly that correctly replaced the raw pointer of the second line?
 
Which anything with more than like 16 cores won't have.
 
4:29 PM
NUMA
or no?
 
@TonyTheLion correct
 
or...

std::unique_ptr<cairo_surface_t> m_surface;
cairo_surface_t *m_surface; // Current image surface

Is the first line creating a unique pointer properly that correctly replaced the raw pointer of the second line?
 
Yes. It shouldn't be e.g. std::unique_ptr<cairo_surface_t*>.
 
The discrepancy between memory and processing power is becoming ever more painful. I have to spend a lot of time thinking about how things fall into place rather than implementing them.
 
4:30 PM
The program (and algorithms) are complicated enough already. Micro-managing the physical placement of memory would be an absolute nightmare.
 
@Mysticial What we need is a modern-day version of the original Cray, which used static RAM for it's entire main memory (no cache or DRAM at all). Then, we just need some strategies for building that in the middle of Antarctica...
 
@JimNorton You'll probably need custom deleter for that.
 
the cycles on pulling something from memory to the cache are just - damn.
 
ok back to the code.... thanks @TonyTheLion
 
It's doable if there was a way to tell the OS to move this region of virtual memory into a specific NUMA node.
But no OS provides this API.
 
4:31 PM
is my thinking right that in functional languages, it's easier to write compilers that 'just know' how to parallelise a problem? I'd have thought so, because of the taboo status of mutable state in functional paradigms. But are there other reasons?
 
@CatPlusPlus Ok, when I get there I'll ask for help... sorry I'm a newbie and I didn't realize my simple class would involve what is to me a complex topic...
 
@Mysticial then what's the point of having NUMA?
 
@Mysticial Is there a way to use HDD instead of RAM for computations? Would having a solid state drive be useful in that case?
 
@TomW Yes, pure code is much easier to parallelise automatically.
You can make much more assumptions, and they never touch global state.
 
many
 
4:32 PM
@TomW it does almost everything for you. Sometimes, it's a benefit, and sometimes - it's a penalty.
 
@TonyTheLion Because physics prevents you from having too much awesomeness in a small amount of space.
 
@keith.layne zxjchvzklxcjvzxcv
 
@TomW Note that not all functional languages are pure.
 
@LucDanton don't think so
 
We don't talk about those.
They're craaazy.
 
4:33 PM
@CatPlusPlus don't put that evil on me
 
@MooingDuck That wasn't a question.
 
@Drise It already does use HDD. 10 trillion digits needed 40+TB of disk to compute.
 
@LucDanton oops
 
no Lisps that I know of are pure
 
@LucDanton yep, aware of that - non-pure languages usually allow you to write pure functions if you want to, right? And presumably they can tell whether there are non-pure expressions that can't necessarily be parallelised?
 
4:34 PM
@Mysticial Oh, right. Would SDD help in that case then? Assuming you could find a large enough one. And have infinite money.
 
see my first ever SO question...pureness is in general undecidable
 
@Drise yes
constexpr means the function is "pure" in C++ unless it's a constructor doesn't it?
 
@Drise It will help, but not by much. The program has been optimized to sequentialize the accesses as much as possible.
 
@keith.layne interesting. So how do languages that are specified pure ban non-pure actions? Is it just a case of refusing to support assignment operators, or whatever?
 
If there was infinite memory, there would be no need to use disk.
 
4:35 PM
@TomW they just lack those primitives
but you can simulate with monads, for example
 
@Mysticial If only we could use fat Americans for memory storage.
 
lol
 
@DomagojPandža I could hold a lot of digits
 
@DomagojPandža I wonder how efficient fat cells are for memory storage...
 
@TomW Monads are used to simulate state, sequence operations and a lot more.
 
4:36 PM
woah, flagged?
 
meh, flags
 
we have a new intern at work who's taking Haskell courses
 
Who the fuck flags that. Seriously.
 
What's flagged?
 
your mom. oooooooooooooh
 
4:37 PM
Most of the development team are 20s-early 30s, and we're all too old for haskell to have been popular while we were studying
 
@CatPlusPlus I was assuming Mystical's "use fat Americans for storage"..
 
so he's getting mobbed for knowledge
 
wow. I heard about Haskell first in about 2000
 
Haskell courses. :Đ I read two documents and started banging away at a raytracer. It's a mindfuck for an imperative overlord such as myself, but overlords adapt.
 
people my age (34) used it in school
 
4:38 PM
And Haskell is old like shit.
 
@CatPlusPlus Suffice to say that as an actual "fat American", I still thought it was funny, not problematic.
 
oh yeah, it's existed for a long time, but AFAIK it's only become really popular in the last few years
 
@MooingDuck A quick glance suggests that's the case, or that it takes at least some acrobatics for it not to be the case. (It's also not wrong to consider constexpr constructors to be pure, in the same vein.)
 
@JerryCoffin seconded
 
@JerryCoffin Not fat, but yes, funny.
 
4:38 PM
Australians are statistically fatter than Americans anyway
 
@JerryCoffin I still don't know what's happening.
 
and they're supposed to be the ones who all live at the beach, surfing and screwing their days away
 
fat people need love too
 
and diets
 
That's why we want to enable them to store data.
 
4:39 PM
and cookies
 
@DomagojPandža One problem. What happens when specific fat cell gets used and removed. Memory corruption?
 
When someone insults them, they can just say, "Fuck you, I'm doing my part for humanity."
 
4 mins ago, by Domagoj Pandža
@Mysticial If only we could use fat Americans for memory storage.
 
@LucDanton I'm less sure about the constructors, since they provide a way to pass state from one function to a later function. I'd have to look into what exactly details a "pure function" Yeah, now that I think on it, constructors are fine too
 
Is the one that was flagged.
 
4:40 PM
@JerryCoffin yep
 
@Drise Well, instead of cooling them, just feed them.
 
So now I have: std::unique_ptr<cairo_surface_t> m_surface; in header
and now I need to replace this: m_surface = cairo_image_surface_create_from_png( imageFile.c_str() );

With the correct code now that m_surface isn't a raw pointer anymore ( cairo_image_surface_create_from_png() returns a raw pointer ).

Help please?
 
@DomagojPandža Forever growing storage?
 
@Drise It's a like a Universe inside a Universe!
 
@JimNorton you can't copy a unique_ptr, so you can't. Point is you can't make copies
remember
 
4:41 PM
@DomagojPandža I hope to god this universe is not just some fat cell.
 
@MooingDuck It may be useful to consider constructors as factory functions for that perspective to make sense. Then the state (i.e. *this) becomes a return value.
 
@Drise It's not. The universe is a figment of its own imagination.
 
I'm simply trying to assign to the unique_ptr... ???
 
@JimNorton m_surface.reset(cairo_image_...);
 
@JimNorton unique_ptr::reset
 
4:42 PM
it's non-copyable, means assignment no work
but reset does
 
Assignability doesn't need copyability, or vice versa.
Two different concepts.
 
ok back to drawing board... thanks...
 
@JimNorton Also, this std::unique_ptr<cairo_surface_t> probably needs to be std::unique_ptr<cairo_surface_t, void(*)(cairo_surface_t *)> or something similar (assuming that the library has a counterpart function for destroying the surfaces also)
 
Anyone like my new picture?
 
4:43 PM
why not just initialize in constructor?
 
doesn't assignment copy the content of object A into object B?
 
@keith.layne That's what I'm trying to do
 
@keith.layne Because it looks like m_surface is a global declared in a header
 
object B = A;
 
blah(file) : m_surface(...), ... {}
 
4:44 PM
looks like a copy under the covers to me?
 
@TonyTheLion It does, sometimes it is omitted. And a lot of the time, it can be defined in terms of the other.
 
@Prætorian It's a private member of a class declared in the header
 
@DomagojPandža so what the hell is @CatPlusPlus saying?
 
@JimNorton Oh ok, then you should probably do what @keith.layne said in the class constructor
 
2 mins ago, by Cat Plus Plus
Assignability doesn't need copyability, or vice versa.
 
4:45 PM
Cat Plus Plus has been smoking way too much Haskell lately. :Đ
 
lol
a cat on Haskell. Funny idea
 
@TonyTheLion You can have a type that is not copyable be assignable. I'm really just repeating what was said.
 
There is not a strict dependency, but the way we do it, it usually ends up countering Cat's logic.
 
auto a = b; is a copy operation, a = b is an assignment operation. One can be allowed and the other disallowed (whichever one).
 
<--- head is about to explode.
 
4:46 PM
Take your time, Jim. :D
 
@LucDanton oh wow, seems like a weird idea though
 
@DomagojPandža ok
 
@TonyTheLion Assignment (normally) means making some existing item equal to some other existing item. Copying means creating a new item that's equal to some existing item. In C++ terms, assignment is operator=, while copying is T::T(T const &); (i.e., the copy constructor). If you want, you can allow one, but not the other.
 
@JerryCoffin yes, but when you implement operator= you do the same in the implementation mostly like you would do in the copy ctor, this was my point
 
@TonyTheLion You're right. They usually come in tandem: a type that is copy constructible usually makes sense to also be copy assignable, and a type that is move constructible makes sense to also be move assignable. And a type that is assignable (in any form) should really be move and/or copy constructible, barring pathological cases. Usually a type is referred as to having copy or move semantics -- which refers to one (or both) pairs of constructor and assignment operator.
 
4:48 PM
@TonyTheLion Usually, yes. But you can decide to do otherwise, if you choose.
 
http://ideone.com/0OXyC
http://ideone.com/zOq8F
 
Forbiding cat forbids.
 
Assignment might make sense even when copying doesn't.
 
ok, I see
learnt something new today :)
 
Look at vector<T>: it requires assignable types, but doesn't require them to be copyable.
 
4:49 PM
ah
 
@CatPlusPlus Past tense :p
 
I thought vector required copy ctor, seems I was wrong
 
@keith.layne Would you expand on this concept please?
 
One does not need the other, but usually, one can be defined in terms of the other to reduce redundancy.
 
lemme find your link....
 
4:51 PM
i would tell you a joke about 9/11 but it's plane stupid.
 
@TonyTheLion Through C++03, it did (§23.1/3): "The type of objects stored in these components must meet the requirements of CopyConstructible types (20.1.3), and the additional requirements of Assignable types." As of C++11, you can substitute move construction for copy construction.
 
JTA
Question from a Win32 noob if you guys have a moment. Is there a reason to programatically create windows (i.e. CreateWindowEx()) vs. using dialog resources for a basic business style apps in Win32? Seems creating a dialog via the resource designer is a lot easier than coding a window. (using C btw)
 
Doing it in raw WinAPI is stupid anyway, so doesn't really matter.
 
@JTA yes, use resource designer. Who the hell wants to write boiler plate anyways
 
<--
 
4:53 PM
an arrow to the chris
 
JTA
Ok thanks. Just don't see the resource designer used in many of the tutorials
 
Use Qt. Or stupid GTK if you can't live without your silly C.
 
@JTA Usually, doing it in code is only required if you're writing hardcore "native" Win32 apps or if you're changing existing elements of the GUI (or creating new) based on user input.
 
@JTA For many (most?) apps, no. Sometimes it's easier/more convenient to write the code though.
 
@JTA meh, hope not online tutorials
 
4:53 PM
@CatPlusPlus I did that years ago.. I was quite fun to write C code using the WinAPI and create my own message pump handlers.
 
@TonyTheLion It's an omega invisible function that returns something chris can take.
 
JTA
Bottom line, I'm coming from doing 99% WinForms in C#. So the dialog resource seems to fit the bill for most of my needs.
 
@DomagojPandža lol
 
@JTA Yes, stick with the resource/dialog creation tools....
 
@StackedCrooked: Sorry, didn't receive your test message.
 
4:55 PM
Stick to C#, why the fuck are you writing business apps in C.
 
What stereotype do you fulfill?
 
poker face
 
I remember once that I wrote a GUI application "by hand" for creating other GUI applications which poops descriptors which are then eaten by the underlying app.
 
Sorry, I was planning to type 'test' into Google to see if my internet is working and suddenly this window popped up.
 
4:55 PM
It was so hardcore.
Pointless, but fun.
 
JTA
@CatPlusPlus Should have clarified. I want a simple 'form' or two like you would see in a business style app. It's functionality has nothing in common however.
 
What would you suggest for reading a text file in C++? (It can be ASCII, or it can be UTF-8)
 
@DomagojPandža no pointers?
 
Whatever it is, you shouldn't use C.
 
@nhahtdh std::ifstream
 
4:56 PM
You C, C is bad.
 
@nhahtdh Butterflies.
 
what should I have for dinner tonight?
 
You still need custom deleters for this to work.
 
already had a kebab today
 
4:57 PM
@TonyTheLion Pizza.
 
Spaghetti.
 
how does that look? There is still the problem of when you call the Set* functions, you'd have to do a reset there, and custom deleters I think to call the cairo destroy functions, but I don't know about that.
what @CatPlusPlus said.
 
@CatPlusPlus And hookers.
 
@nhahtdh Read it as UTF-8.
 
JTA
@CatPlusPlus Care to explain why? I tend to enjoy it for when I don't want to use C#.
 
4:58 PM
@CatPlusPlus is that all you ever eat?
 
@keith.layne Ok looking... thank you
 
@R.MartinhoFernandes: How about the BOM?
 
Utterly Tremendous Fuck - 8
UTF-8
 
@nhahtdh What about it?
 
4:59 PM
@R.MartinhoFernandes BOM has ties with the MOB.
 
An UTF-8 reader eats ASCII for breakfast. Doesn't even break a sweat.
 
Why is the swap function public? http://ideone.com/Pdr2I
And what does making it a friend function _inside_ the class mean?
 
@nhahtdh UTF-8 doesn't have a BOM. It only makes sense for UTF-16 and/or UTF-32/UCS-4.
 
@JimNorton gotta go, but these guys know infinitely more than me anyway.
 

« first day (646 days earlier)      last day (4310 days later) »