« first day (902 days earlier)      last day (4050 days later) » 

3:00 PM
English tenses do not suffice to explain it precisely.
 
"omg you all along!!!111"
 
We need Lojban.
 
@DomagojPandža :)
I accidentally the whole all along
 
What's the easiest way to unroll a loop to add multi threading in c++11?
Like parallel_foreach?
 
Use a library with parallel_foreach.
PPL, TBB, just::thread maybe.
 
3:03 PM
yeah I was thinking about threading my vector calculations
 
HELOOOOOOOOOOOOOOOOOOOOOOOOO PEOPLE!!!!!
I missed this place so much! :D
 
Your mum took away your computer privileges?
 
@R.MartinhoFernandes Doctor Who did that a lot in S5's finale. Everybody was stuck, so the Doctor magically appeared from a future in which he had previously escaped by being unstuck by his future self
 
@LightnessRacesinOrbit: Whats up? Long time no see.
@DomagojPandža No, my computer died. :(
 
You have only one computer?
 
3:05 PM
"Time travel; it can happen" sigh
@GamesBrainiac okay
 
Pointers do not magically make programs faster. — FredOverflow 8 secs ago
 
user1357851
I have 3 granny computer/laptops (3+ years) old. This makes me sad
 
@FredOverflow lol
@FredOverflow tell that to my teacher! :P
 
@GamesBrainiac You should still learn how to use them :)
 
@Grapes I think I have
Not that difficult really
 
3:08 PM
@Telkitty My computer is from 2007 or something. It makes me proud that I can still use it.
 
Xeo
Same
 
@GamesBrainiac It is really simple :) Just don't forget about deleting dangling pointers
 
@LightnessRacesinOrbit Hmm, the way you put it it sounds like a cheap deus ex machina. Though it might just be the way you are summarising it.
 
Xeo
Need to get a new one. :s
 
3:09 PM
C++ Is a bit tricky with inheritance, pointers and containers
so that's one thing you should watch out for
oh and also downcasting too
 
@Grapes Why would you want to delete a dangling pointer? :)
 
@LightnessRacesinOrbit For some reason I don't enjoy doctor who at all =/
 
@Grapes Yes, deleting freed memory pointed to by a dangling pointer. What could possibly go wrong?
 
@Grapes Learning to use pointers is totally not the same as learning to do manual memory management.
 
I never really feel like I -learn- OpenGL, just memorize tons of functions
 
3:10 PM
@R.MartinhoFernandes It came across that way. It was saved by the acting and by the fact that it was still kinda cool time travel. And because the rest of the plot was entertaining enough.
 
@Grapes just use std::uniqueptr
 
The latter is useless except in very controlled and unusual environments.
It isn't worth learning.
 
@FredOverflow probably it doesn't support new cool stuff like, say, C++AMP
 
The former is useful, and yes should be learned.
 
@Abyx I don't even know what that is. Oh, it's a Microsoft thingie? I don't use Windows anymore.
 
3:11 PM
@Crowz Don't memorize functions, learn the principles. You've got the OGL reference for a reason.
 
If you think "memory management" when you hear the word "pointers" I think it's time for you to learn C++, because you aren't there yet..
 
Anyone here tried Go?
 
@DomagojPandža yeah but it seems so much of it is like glu.setPerspective(ORTHAGRAPHIC) or something, you know what I mean?
 
Orthographic.*
 
@Crowz Sounds like you are learning outdated OpenGL.
 
3:13 PM
@GamesBrainiac Does Go have generics yet?
 
I just made up an example haha
 
Also, perspective projection and orthographic projections are two different kinds of projections.
 
@FredOverflow No.
 
@FredOverflow No
 
3:13 PM
@FredOverflow No.
 
@FredOverflow No.
 
meh meh
 
@FredOverflow No
 
user142019
@FredOverflow No.
 
lol
 
3:14 PM
@DomagojPandža yeah that was more of an example. I feel like tons of lines are just like glu.(something)(some variables)
 
meh meh meh
 
@FredOverflow It has interface Any {} which can cover various use cases of generics. But yeah, it's sub-optimal.
 
user142019
Maybe they'll add it in the future.
 
user142019
Would be nice.
 
Go has, more or less, something akin to Haskell's typeclasses, but with types limited to the * kind. No * -> * for you.
 
user142019
3:15 PM
yo @ScottW
 
user142019
@ScottW it won't build.
 
user142019
You need to build as Objective-C++, not as C++.
 
@Zoidberg From what I read, they don't think it is worth the added complexity.
 
I come from c# world and I still don't trust smart pointers
 
user142019
3:16 PM
Maybe they'll change their minds in the future. :V
 
@Grapes ?
 
@Zoidberg Java designers though the same, and then you get the messy crap you have now.
 
I use pure pointers, I feel like smart pointers is cheating a bit
5
 
user142019
@R.MartinhoFernandes :P
 
@Grapes You have to trust the smart pointers, and the smart pointers have to trust you. It's a mutual trust thing. It won't work if you goal is to break the system.
 
3:17 PM
@Grapes You're a moron.
2
 
@Grapes It's not a game.#
 
@Grapes ignore feelings while programming
 
@DeadMG <3
 
@Grapes Pure pointers? Virgin pointers? Vanilla pointers? :)
 
ArenaGC ftw.
 
3:17 PM
can someone explain what a "buffer" is supposed to mean in terms of graphics?
 
I mean, do you guys really create an std::vector of smart pointers?
 
@Grapes Yup.
 
crazy
 
Virgin pointers vs exgirlfriend pointers
 
and not only did I do that
 
3:18 PM
@Grapes I mean, do you really write exception-unsafe loops with delete?
 
but I went and made a proposal to the Committee so that you can use them in more other containers.
 
@Grapes what else? if you must do polymorphism or can't just have vector<T>
 
T*?
 
@Grapes Rule #1 of Programming: Cheat whenever possible.
12
 
@Grapes right. have fun
 
3:18 PM
@Grapes Stay away from my code.
 
@ScottW not so sure anymore, are you now?
 
@Grapes You mean, "Can I please double delete my memory, leak it, access it after deleting, and delete incorrect pointers"*?
 
But, I wanted to ask, what does this exactly mean Template &* someVar
 
Get close to my code.
Keep your code away from me.
 
3:19 PM
as an argument to a function
 
I am not trolling... I just haven't gotten around to using smart pointers yet
I am not a c++ programmer by any means
 
0
Q: How to clear the dynamically allocated memory, which is in Heap?

YohanPlease have a look at the following code #include <iostream> using namespace std; class Memory { private: int *memory; public: Memory() { memory = new int[3]; for(int i=0;i<3;i++) { memory[i] = i; cout << memory[i] << endl; ...

 
@GamesBrainiac A reference to a pointer to a Template, which is named someVar.
 
@Grapes Then why are you wasting time learning unimportant stuff?
Biggest C++ feature is RAII.
 
@DeadMG Is this kinda thing fairly common?
 
3:20 PM
I use stack as much as possible and make sure my heap objects are deleted
 
@Grapes std::vector<std::unique_ptr<T*>>. Problem?
 
@ScottW JavaDeath, sound likes a metal band
 
@Grapes Let me translate that into normal English: "I used to use C#, and that destroyed my ability to think."
 
@Grapes I don't to any notable extent, as it happens.
 
You might be surprised that we don't using namespace std;.
 
3:20 PM
what about peformance hits with smart pointers?
 
@GamesBrainiac I wouldn't necessarily call it "common", but it's far from unusual. There's no reason you can't refer to a pointer.
 
or is it almost non-existant?
 
@Grapes There isn't any.
 
@Grapes Nonexistent.
 
Gotcha
 
3:20 PM
@Grapes go back to c#. or start using unique_ptr
 
well I might as well start using them
 
they are superior to raw pointers in every way when used for memory you need to delete.
 
@Crowz an array
 
@Grapes If you're optimizing on smart pointers, you should consider a career in botany.
4
 
shared_ptr is slow
 
3:21 PM
@FredOverflow but isn't the float array how the vertices are drawn?
 
yes I understand that shared_ptr would be the last one to use
 
@Abyx shared_ptr is too much for what people use it for. I can concede you that.
 
unique_ptr all the way
 
@Abyx unique_ptr is the primary smart pointer.
 
unless you have to use shared_ptr
 
3:21 PM
@Abyx well, at least it does more
 
@DeadMG Got it thanks.
@DeadMG : So in essence, its an immutable pointer, right?
 
@GamesBrainiac T&* someVar would be a poiner to a reference, which is illegal in C++.
 
Well, a few shared_ptr won't kill you. The key is to know where you need them and where you don't. You can shoot yourself in the foot with almost anything.
 
@GamesBrainiac nope
 
What should people using old compilers use? Is auto_ptr acceptable?
 
3:22 PM
but it's ok to still use pointers for non-ownership pointers right
 
@kbok I write my own unique_ptr without move ctor. never use auto_ptr, it's weird
 
@DomagojPandža unique_ptr<T*> looks very suspicious. Are you sure you didn't mean unique_ptr<T>?
 
@LightnessRacesinOrbit Close votes, please.
 
@Grapes Use references instead of pointers then
 
3:23 PM
@Zeta I was asking about T &*
but never ming
I think I got something wrong there.
 
@Crowz What? There are different kinds of buffers. A vertex buffer stores vertices for sure.
 
@kbok can you give me an example?
 
@GamesBrainiac That's impossible in C++.
 
@GamesBrainiac It should be T*&, by the way, not T&*.
 
@R.MartinhoFernandes yep
 
3:24 PM
I think.
 
@FredOverflow Wait, what... I didn't... I did. Reflex.
 
@Grapes yes
 
@kbok Reference members are troublesome.
 
@Grapes void func(type &var)
 
3:24 PM
@DeadMG Yea, sorry thats what I was trying to get there.
 
@FredOverflow why call it a buffer? Does that have some specific implications as to graphics cards? Like is it allocating a little bit of memory on a graphics card if that makes sense?
 
@Crowz Yes, buffers are memory on the graphics card.
 
@R.MartinhoFernandes Reference members are awesome
 
@Crowz Yes, that is usually how it goes.
 
@kbok yes, that's how references work. I was talking about smart pointers
 
3:25 PM
@LightnessRacesinOrbit At least he tries to be funny.
@LightnessRacesinOrbit: No, my cat ate it. Why? — Yohan 4 mins ago
 
in Java Sucks, 3 mins ago, by simonTifo
I want to have friend in stackoverflow
^ Anyone up for that? :)
 
He wants to put friends into SO?
 
@Grapes Nothing special about it. Just use them.
 
btw, will C++14 have std::optional?
 
3:26 PM
@Abyx It's due for more consideration at Bristol.
 
@Abyx There is a proposal.
 
@Abyx Hopefully.
 
but if your feature doesn't get in in Bristol, then it's almost certain not to happen.
 
Btw, this "Modern C++" style thing consists of using RAII, which is a feature that was already in the language in the 1990s. Yes, it's that modern. — R. Martinho Fernandes 34 secs ago
 
ok I am going home and rewriting my stuff to use smart pointers
 
3:27 PM
I kinda sick of using unique_ptr instead of optional =(
 
should've done it from the start
oh well
 
@Abyx Then use optional instead?
 
@Grapes You don't need to use smart pointers everywhere. Can you show us some use cases?
 
@Abyx I believe the basic stuffs will be there. They split the controversial bits (optional<T&>, etc) into separate additional proposals to maximize the chances of getting at least the parts everyone agrees with in.
 
@FredOverflow well I try to use stack as much as possible. But class B::A you can't add instances of B into std::vector(A)
so I always used std::vector<A*>
 
3:28 PM
@R.MartinhoFernandes It was in C from conception. Automatic storage, bro!
 
@R.MartinhoFernandes So should I not mention "Modern C++"?
 
@Grapes B::A is meant to express inheritance?
 
now I'll use std::vector<std::unique_ptr<A*>>
 
@Grapes You mean class B : A
 
@AndyProwl Nah, it's ok. It's what everyone uses, anyway.
 
3:28 PM
yes
 
@Grapes boost::reference_wrapper
 
@Grapes That's the ideal solution for that particular use case, yes.
 
@R.MartinhoFernandes All right, thank you
 
I do feel it gives the wrong idea. But I don't think being accurate at the expense of communicability is worth it.
 
@R.MartinhoFernandes MSVC is accelerating towards a brick wall. C++14 is right around the corner and they haven't even gotten around to implementing C++11 proper. :(
 
3:30 PM
@Grapes std::vector<std::unique_ptr<A>>, surely?
 
hehe :)
 
of course, i haven't used smart pointers yet
 
Do you really actually need vector of pointers
 
@Grapes It's T, not T*.
 
@kbok boost::ptr_vector.
 
3:30 PM
it's hard to believe how long we've had C++11
 
yep yep
 
@CatPlusPlus He uses subtype-polymorphism, so yes.
 
@kbok Reference wrapper is not better: it's non-owning.
 
though it's also far less time than simply subtracting the year numbers would suggest
 
yes I need it cat
 
3:30 PM
Yes the question is "do you need subtype polymorphism here"
 
@R.MartinhoFernandes I misunderstood his problem actually
 
stream of consciousness
 
maybe he just need a stable_vector
 
@Abyx That doesn't really help with the polymorphic storage problem.
 
@CatPlusPlus Yes, I used std::vector<T> When I could, but in cases where I had to use subtype, I had no choice but use std::vector<T*>
 
3:32 PM
So yeah, ptr_vector
 
@Grapes "no choice".
 
@R.MartinhoFernandes yep, it addresses another problem
 
I rarely use subtype-polymorphic vectors these days
 
Lazy != no choice.
 
@CatPlusPlus I use it all the time. DisplayObjectContainer:DisplayObject
you have std::vector<DisplayObject*>
 
3:33 PM
Yeah that doesn't mean you have to, it usually means your design sucks
 
@CatPlusPlus can you explain how that above example sucks?
 
I don't know what display object even means
 
@Grapes That's impossible without context and domain knowledge.
 
@CatPlusPlus It appears he is using the Composite Pattern :)
 
Haskell has pure pointers.
 
3:34 PM
Fuck patterns
3
 
fuck cat.
 
std::vector<DisplayObject*> is perfectly valid with DisplayObjectContainer:DisplayObject
But boost::reference_wrapper looks amazing
 
Well, @CatPlusPlus how do you implement a view hierarchy without polymorphic collections?
 
Thanks @kbok for that
 
3:35 PM
@Grapes It isn't perfectly valid if you have a loop somewhere not-a-destructor for deleting them.
 
in C#, 31 secs ago, by rlemon
since when does Gravatar require a WP account?!?!? https://en.gravatar.com/site/login/
 
@Grapes Actually you need boost::ptr_vector because it has ownership
 
@kbok could I just use unique_ptr
std:vector<unique_ptr<DisplayObject>>
 
std::vector<T*> with owning pointers has a broken ownership contract, so it cannot be outside of an ownership building block.
 
I'll get back to you on UI toolkit design when I'm done with uni and have time to design an UI toolkit
 
3:36 PM
@Grapes You could but ptr_vector is worth looking at
 
@Grapes That works too.
 
Wonderful
 
ptr_vector has a more streamlined interface IMO.
 
@CatPlusPlus you're a mehcakes factory
 
@R.MartinhoFernandes What exactly is a "streamlined interface"?
 
3:37 PM
[] returns reference not a pointer
 
@FredOverflow It has the interface of vector<Base> (without slicing) instead of vector<Base*>.
 
I don't know whether that is a good or a bad idea...
 
Good if you ask me.
 
Should I ask you?
 
1
Q: Will Gravatar's new Wordpress-only policy affect us?

Lightness Races in OrbitLogging into gravatar now requires a Wordpress.com account. What consequences, if any, might this change create for the use of Gravatar on Stack Exchange sites?

 
3:38 PM
I'd call it poly_vector or something because pointers are just an implementation detail you don't deal with
 
I use a lot of exceptions so moving to smart pointers is the best idea for me
 
Ell
is value_ptr one which copies the thing it points too?
 
Gravatar always used Wordpress.com accounts
 
@LightnessRacesinOrbit SE has custom avatars now.
 
3:39 PM
@Ell yeah
@CatPlusPlus I'd call it polite_vector
 
Jeremy Tunnell on January 15, 2013

One of our New Year’s resolutions here at Stack Exchange is to take a hard look at our user experience. As the network has grown and our audience expanded, the system has grown with it – but there are some rough edges in places that can use a bit of smoothing. You’ll be seeing a lot of improvements over the next few months, but today I’d like to announce the first bit of polish: built-in profile pictures.

We have used Gravatar to let you manage your profile picture since roughly six to eight weeks before Stack Overflow entered beta. Gravatar is a wonderful service that lets you use a con …

 
auto element = v.would_you_mind_fetching(4);
 
@kbok thanks a lot by the way. You helped convince me to use smart pointers :)
 
@Grapes np, and good luck :)
 
@kbok lots of stuff to rewrite, but it'll be worth it
 
Ell
3:42 PM
ahh my fucking gawd I just clicked on annie.jpeg :o
 
> I've just learned when jettisoning something in orbit, don't do it backwards. It will follow you.
@R.MartinhoFernandes I'm aware.
 
Then I guess I didn't get your question.
 
Gravatar and WP.com always had combined account databases, they just federated the login on Gravatar part now
I don't know why this needs a thread or even thinking about
 
Is it a good idea to have an alias for std::unique_ptr? Like UP<T> or some other name
 
3:44 PM
As long as it's not a macro.
 
Okies
 
@R.MartinhoFernandes I'm not sure what's complicated about it. The question has nothing to do with SE's custom avatars. It's about the Gravatar support, hence the tag. And all of the text.
 
@R.MartinhoFernandes Don't encourage people to shorten names they're too lazy to type out :v:
 
@CatPlusPlus Just because a question has an answer doesn't mean you shouldn't ask the question, gees.
 
humph
I don't suppose anyone wants to subsidise my costs of going to Bristol
 
Ell
3:46 PM
How much? :3
 
@LightnessRacesinOrbit Meh, the answer is right there on the screen shot...
 
well, the hotel is going to be in the range of £250 :P
oh well
 
@Grapes UP is a terrible name, though.
 
@R.MartinhoFernandes Agreed, just an example
 
it'll be worth the cost when I can put "Co-author of the motherfucking Standard" on my CV.
 
3:47 PM
@R.MartinhoFernandes I would never use that personally
 
@DeadMG Woah.
 
Ell
How far away from bristol uni is it?
 
template<typename T> using own = std::unique_ptr<T>;
 
@R.MartinhoFernandes whatever_ptr for the win.
 
@FredOverflow love that
 
user1357851
3:47 PM
lol, the imposter :x
 
@DeadMG Maybe, but it's out of range of Fatty Kim's missiles.
 
@Ell About a mile or so. The conference is close to Bristol Temple Meads, I think. Let me check the venue location again.
 
Don't make pointless aliases, they just obscure the code
 
oh isocpp is down again
 
@DeadMG 300€? How many days?
 
3:48 PM
@R.MartinhoFernandes five
 
@Grapes As long as you write the code just for yourself, I don't see the harm. But be prepared for "WTF is this own template?" when you ask for code reviews.
 
user1357851
@MartinJames wait, missle is to be fired, before, after or during puppy's stay?
 
Ell
I would chip in xD
 
mon, tue, weds, thurs, fri- the meeting begins on mon and ends on sat.
 
@FredOverflow :) I should call it NotOwner just to get fired
 
3:49 PM
so I'm taking the train there at about 5am on Monday morning, and then coming back home at about 10pm or so on Saturday.
 
Ell
but I don't have £250, to give away or otherwise :P
 
@FredOverflow Wouldn't that be a non-issue with non-stupid IDEs nowadays?
 
@Insilico It's still an issue because it requires action.
 
@Insilico Is there a non-stupid C++ IDE?
 
@FredOverflow Good point.
 
3:50 PM
@Ell Yeah :P
 
Hm, beat the average to get Killing Floor.
 
@FredOverflow Hopefully, JetBrains's won't be.
 
I wonder if I should.
 
and the next meeting will be in San Francisco
 
Ell
@DeadMG Do I remember correctly that wide can do arbitrary things at compile time?
like, IO?
 
3:51 PM
@R.MartinhoFernandes And the answer to most C++ questions is right there in the standard or a good book. Still, we archive them on SO in a text format.
 
@Ell In theory, yes.
 
@R.MartinhoFernandes JetBrain has a C++ IDE?
 
I haven't actually implemented that part yet
although I suspect it will be substantially simpler than I had previously imagined
 
@Insilico They're working on one.
 
Ell
3:51 PM
@DeadMG so I can make sure my code only compiles on a full moon?
 
yes
 
I'd quite like to make the Bristol meeting
 
@LightnessRacesinOrbit Still, we archive them on SO in a text format. for Googlebots to index them. FTFY.
 
@FredOverflow doesn't compile in VS2012 btw: template<typename T> using own = std::unique_ptr<T>;
 
haha, VS 2012.
 
3:52 PM
@Grapes VS 2012 does not support template aliases yet.
 
eh, someone fucked up isocpp.org
 
That was funny. No C++11 for you.
 
god
@FredOverflow Oh well, i'll use unique_ptr then
 
#define own std::unique_ptr
^ JUST KIDDING!
 
fuckin' webgl...
 
3:53 PM
Shit, I left my laptop turned off.
 
@LightnessRacesinOrbit ass by preference
3
 
@FredOverflow why just kidding?
 
It's a horrible idea don't do that ever
 
ok
 
Because macros are evil. What if there is int own = 42; somewhere in your code? You'll get a horrible error message.
 
3:54 PM
@FredOverflow gotcha
 
wait, wait, wait.
 
i don't use enums
 
you can't come in here espousing the benefits of raw pointers, and then actually be educated and understanding about it and accept the benefits of smart pointers.
 
I use enum classes
 
that's gotta be violating some cosmic law
 
3:55 PM
haha @DeadMG :)
 
People actually listening?
In my Lounge?
 
@DeadMG lol, sensible people. Who would have imagined that?
 
I mean
 
@R.MartinhoFernandes Sensible people, where?!
 
No, you don't.
 
3:56 PM
new people and intelligent ideas are like leptons, putting them in the same place at the same time violates the Pauli Exclusion Principle
 
Not incorrect, but s/leptons/fermions/?
 
@DeadMG Well, excuuuse me, Princess.
 
@DeadMG I honestly prefer to use smart pointers due to exceptions, just never tried them before. And now kicking myself
 
Wait til you discover (and understand) Monads!
 
@R.MartinhoFernandes identical fermions.
 
3:58 PM
@FredOverflow Do you, finally?
 
@FredOverflow :D:D:D
 
@R.MartinhoFernandes I have a medical condition which makes me unable to comprehend Monads.
 
Ell
How do you know when you understand monads?
 
@Ell You do.
 
@DeadMG comma abuse. ffs.
 
Ell
3:59 PM
I understand monads? thanks! :D
 
@FredOverflow The human condition?
 
@Ell You've never had the experience where everything all of the sudden makes complete sense?
 
@Ell You understand monads when you write a monad tutorial that nobody unfamiliar with monads can understand.
 
I meant that when you understand them, you know it.
 
3:59 PM
@Insilico s/the/a/
 
Ell
@R.MartinhoFernandes No no no too late, I understand them now.
 
Like I do :smug:
 

« first day (902 days earlier)      last day (4050 days later) »