« first day (524 days earlier)      last day (4425 days later) » 

9:07 PM
is there anyway to see which posts I upvoted?
 
@bamboon only while visiting those posts.
 
@daknok_t crap
@ScottW probably a good idea
 
@bamboon even better: write a script that does it for you.
@ScottW well, you need software to visit stack overflow anyway.
@ScottW that's false.
One cannot carve that fast.
Pics or it didn't happen.
(Scott is actually getting a stone, a chisel and a camera right now.)
 
9:23 PM
That's a cock!
 
That graph has bears an uncanny resemblance to a penis.
 
I pity the one whose cock has that shape.
 
I didn't even see the resemblance
I'm starting to lose the feel for all things sex, I'm so deprived, I'm lost
 
@TonyTheLion That means you are ready for the next level of kinky shit.
 
9:27 PM
Like aliens!
 
@StackedCrooked euh....
 
@StackedCrooked or he needs a girlfriend, one of the two. Depends on how you interpret that.
 
Or both..
@ScottW Certainly from a financial pov :)
 
1
A: Are there any useless language features in the C or C++ language?

DeadMGGood C++ programmers rarely, if ever, use void* Preprocessor for constants/inline functions, and to a lesser extent, xmacros Multi-dimensional pointers Protected/private inheritance Integral pointer conversions Unions Function pointers Member function pointers Off the top of my head, I'...

upvote me so I can look more awesome because I bash other inferior languages!
 
void* is used for type erasing sometimes.
 
9:39 PM
> rarely
 
Words.
I've fixed fullscreen mode!
Or I think I did. Screen's blinking when starting the app, so I think it changes the mode as it should.
 
Xeo
Damn, cola bottle cap, Y U NO WHERE CLOSED COMPLETELY?!
 
What are you doing on Programmers, anyway?
 
I think std::bind(&MyFunction<T>, t); is lovely form of type-erasure. It kind of glues the compile-time world with the runtime-world.
 
There be dragons.
 
Xeo
9:42 PM
@StackedCrooked Once you get polymorphic lambdas, bind can kiss his ass.
 
Operator overloads on bind are nice, though.
 
Xeo
That's only boost::bind
 
@Xeo I should check it out then.
 
Xeo
(and boost::lambda::bind and boost::phoenix::bind)
@StackedCrooked Well, C++ doesn't have them yet. :|
That's kinda the problem
Okay, so, my bag is soaked in coke
 
They'll be added right after they make the grammar less insane.
 
Xeo
9:43 PM
I think it's made of nylon
 
std::count_if(items.begin(), items.end(), boost::bind(&Item::value, _1) == 0); doesn't work with std::bind and I think it's a pity because it's a less ugly syntax than the lambda one.
 
@StackedCrooked No type erasure is involved in this.
 
It's still ugly.
 
Xeo
Can I just stuff that into the washing maschine?
 
Yeah, std::function is type erasure.
 
9:44 PM
@LucDanton Dammit. Will the day ever come that I make a correct statement?
But, why isn't that type-erasure?
 
Xeo
@StackedCrooked std::count_if(items.begin(), items.end(), [](Item const& i){ return i.value == 0; });
I think I like the lambda one more.
It also doesn't involve a (member) function pointer
 
Both are fugly.
 
@StackedCrooked It's a function template, so it doesn't need it. Type-erasure happens with class templates.
 
I'm using the wrong word then.
 
It's generic ;)
Works uniformly for all kinds of callable types.
 
9:46 PM
I have a todo list now!
 
@CatPlusPlus I wrote one myself for one of my projects just earlier D: Great minds etc.
 
Time to write some docs.
 
Hi all again!
 
@CatPlusPlus Woo!
 
Did you write yours because it was going to be the week-end and you needed to retrieve what you were thinking of next time you'd get back to your project? My todo list is a rough braindump.
 
9:49 PM
I want to at least try to focus on features needed for a particular release.
 
@Xeo Yeah, std::bind(&Item::value, _1) binds a method. Is it not possible to bind to member variable?
 
@StackedCrooked It is.
 
Xeo
@StackedCrooked No, you can perfectly well bind any member pointer
 
@LucDanton What is the syntax?
 
Xeo
I misplaced the parens
It should've been "member (function) pointer"
 
9:51 PM
@StackedCrooked Same. E.g. std::bind(&std::pair<int, double>::first, _1).
 
Xeo
Dammit, how do I clean this bag?!
 
We need a sister-concept to perfect-forwarding, something with a name like 'perfect-storing'. I'm still not sure what's the preferred way to handle this.
 
@LucDanton I'm not sure I understand, but decltype?
 
@LucDanton Heh, never realized that. Tried it a few times in the past and for some reason didn't get it to work back then. I wanted to ask for a long time but never came around to doing it..
 
Xeo
@LucDanton Eh, I think I know what you're after. Store something the way you're given and extract it the same way?
 
9:55 PM
@Xeo Yeah, but I'm entirely sure what 'the same way' should be. E.g. with respect to value-category and the like.
 
Xeo
You can actually do that by overloading on all possibilities, but for long-term storage, you'll always need to move temporaries into a value type
 
Something like std::ref?
 
Xeo
I did exactly that for my positional parameters, actually
 
For instance I don't think std::async([](T&) {}, std::move(t)); works for std::unique_ptr<U>.
 
Xeo
Er, no, how would it?
Oh, wait
std::async stores if you don't pass std::launch::async
 
9:57 PM
Right now I've been considering a value-wrapper that mimics what std::ref used to do with C++03 forwarding. The end result is sort of esoteric though.
@StackedCrooked Yes. But in reverse, somehow, if we stick to perfect-forwarding.
 
Xeo
template<class T>
struct storage{
  T& value;
};

template<class T>
struct storage<T&&>{
  T value;
};
 
@Xeo With the exception of functions that run for a long time. int main() { run(std::string("hello")); }, you can use the rvalue-reference for the entire duration of the program now :D
 
Xeo
with appropriate "make_storage" overload kind of things
 
I think the C++03 convention is worse than such a value-wrapper however and there's std::bind as proof for that.
 
Xeo
I think the above is what I had for my positional parameters
And I think I should rename them to position independent parameters
whatever.
 
10:00 PM
@Xeo The problem is not with the storing but what value-category should be used when restoring?
Storing is as easy as storing T given a perfect reference.
 
Xeo
@LucDanton Hm. Since you can't differentiate between xvalue and prvalue when you get it, I don't think you can map to the original value category all the times
so I'd probably just return an xvalue for "stored temporaries"
Actually, that doesn't matter.
Just return an xvalue, you can't find out a difference to a prvalue anyways :D
(I think)
template<class T>
struct storage{
  T& value;
  T& retrieve() const{ return value; }
};

template<class T>
struct storage<T&&>{
  T value;
  T&& retrieve() const{ return std::move(value); }
};
Something like this
 
So given a callable object o with signature void(T&) then bind(o, std::move(t)) doesn't work. Hence why I felt the need for bind(o, emplace(t)).
(Where emplace(t) is the same as val(std::move(t)).)
 
Xeo
@LucDanton Ah, you're after someting different
you want to move into the storage of the bind object, but get an lvalue out of it
that's not perfect storage then, though.
 
I want to see if there's a 'convenient' way to handle that case.
But I'm worried that the end result is esoteric, which would mean it's not really added convenience.
 
Xeo
Why would it? If you have a function that takes an lvalue and you want to pass an xvalue/prvalue, well, won't work.
why do you want to make it work?
Wait
 
10:07 PM
@Xeo Because wrapping is ugly: bind([](T&& t) {foo(t); }, std::move(t))
Contrast with bind(foo, emplace(t)). Is that a net gain in convenience/expressivity or not?
 
Xeo
Geh, GCC 4.5.1's bind doesn't perfect forward it seems. It tries to copy the unique_ptr here
 
Ye that's the old C++03 std::bind.
 
Xeo
Anyways, void f(T&){}; std::bind(f, std::move(t)); should actually work. It moves into the internal storage and gets an lvalue from that.
 
Again, the name bind is a placeholder.
The goal is to find a convention, not reimplement bind.
 
Xeo
I know, but you're not after perfect storage
that would mean you get a T&& passed, not a T&
 
10:10 PM
Perfect restoring?
 
Xeo
Now, I'm kinda lost to what you actually want to achieve. My brain's been a bit fried today, sorry. You want void f(T&){}; stores_and_passed_t_to_f(f, std::move(t)); to work, did I get that right?
 
std::bind really is ugly by the way. For instance the norm is that an interface dealing with smart pointers will accept T or T&&, and almost never T&. So putting smart pointers inside the std::bind wrappers is inconvenient (unless dealing with pointers to members because then they're dereferenced).
 
Xeo
@LucDanton Actually, I got convinced that shared_ptr should be passed by ref most of the time. I sometime need to amend my answer I gave on that Q on SO...
 
@Xeo It's fine that it doesn't work (that's type safety in action), but it'd be nice if there was a way to express the intent 'take ownership, restore as lvalue'.
Like std::bind(foo, std::ref(t)) is a convention to express "don't take ownership, restore as lvalue ref".
 
Xeo
@LucDanton The thing is, that actually works. It will only stop working after you do "perfect storage"
 
10:14 PM
@Xeo You're free to be convinced of wrong things, but I want no part in it.
 
Xeo
Pff, convince me to switch back again :P
 
@Xeo Can you make it work without it being std::bind?
@Xeo Why? What's my incentive?
 
Xeo
@LucDanton Well, every long term storages that uses pefect forwarding will need to store temporaries into actual value types at one point. "perfect storage" would now be if the retrieval of such a temporary would again produce an xvalue. Normal storage just gives you an lvalue. I don't see how that would work any other way, but maybe I'm overlooking something.
 
@Xeo Yeah, that's already working. That's a given.
10 mins ago, by Luc Danton
@Xeo Because wrapping is ugly: bind([](T&& t) {foo(t); }, std::move(t))
9 mins ago, by Luc Danton
Contrast with bind(foo, emplace(t)). Is that a net gain in convenience/expressivity or not?
This is the important bit.
 
Xeo
You need neither without "pefect storage".
I really must be overlooking or misunderstanding something
 
10:18 PM
wat
Why don't I need it? What's the alternative?
 
Xeo
bind(f, std::move(t)). But this is bugging me. We seem to talk at cross purposes (is that the right wording?). Anyways, I get the feeling we don't really talk about the same thing.
 
Doesn't work for f taking T&.
I'm sorry but I mixed the discussion of "what I have so far" (i.e. perfect forwarding + perfect storing) with "why what we have right now isn't good enough" (i.e. unholy mix of C++03 decay-storing + C++11 perfect-forwarding like std::bind).
I shouldn't have used bind as a placeholder name.
Perfect forwarding + perfect (re)storing has one 'blind' spot in that it's not possible to express "Store that value and restore it as an lvalue". So I decided to add a val feature to help with that just like ref was added to C++03 decay-storing to allow for shallow-copy semantics.
Is that a good summary?
Heh, I'm going to check if val works with std::async & others.
 
Xeo
This is what I was thinking and talking about
 
You can just store T.
 
Xeo
... Damn, yeah.
@LucDanton So you were talking in the assumption that we already got perfect storage?
 
10:30 PM
Perfect-forwarding is as follows: T&& to perfectly forward (but beware dangling rvalue refs), T to 'safely' perfectly-forward (but beware superfluous move-construction that ends up as a costly copy) or to perfectly store, T& to perfectly have an lvalue reference, std::decay<T> to decay store C++03 style (but beware use of std::ref to enable shallow copy semantics).
@Xeo Yes, I'm convinced that it's superior to C++03-style. std::bind is somewhat painful with move-only types.
 
Xeo
Okay, then I got the whole discussion wrong. I thought you wanted to have perfect storage to make void f(T&); blargh(f, std::move(t)); work.
Sorry for that
 
I'm okay with it not working. I could possibly make it work, but I think that's confusing to use regardless of how hard that could be to implement.
What do you know, that val thing does work with std::async and std::thread.
Although those don't do perfect-forwarding+perfect-storing, to clarify. They're a bit more sensible than std::bind but not by much.
 
11:05 PM
anyone in here?
 
no, there's nobody here
 
um..I have a question
 
is it an interesting question?
 
not sure
 
11:09 PM
make it fabulous
 
I'm reading a c++ book and I came across the new and delete operators and it said to always delete your "new" memory and it said if you don't it would clutter overtime. Then later in the book it was using new but it didn't delete. Does it auto delete?
 
Yes, you should always delete your new so to speak. The other sections of the book may simply omit the delete portion of code for brevity.
 
Either it was deleted at another place. Or it was a bad book. We can't now without seeing the code.
 
did it mean it would clutter during runtime and it would slow if you used new a lot or that it would never be freed till the computer restarts
 
@AidanMueller Btw, you should learn about RAII and smart pointers in order to find the answer to your question.
@AidanMueller The memory will be freed after you quit the process.
 
11:15 PM
ok so if I have a program that uses new once and it's very small and will probably terminate in one second, do I still need to delete
Not considering it's good practice
 
it's probably a bad idea
today it's heap memory, tomorrow it's inter-process memory or something the OS cannot clean up
and destructors can perform other actions like logging that can be essentail
 
ok, so always use delete and RAII. thanks all
 
no no
always use RAII, never use delete
 
um...ok...I will go read about raii now. bye
thanks for answers everyone
 
he sounds scared
 
11:30 PM
I need to stop eating myself stupid
 
@DeadMG: You could try having fruit. :-) Mindlessly eating grapes is better than mindlessly eating other things
 
eh
that doesn't work for me
I eat it and then it feels like I've eaten nothin
not that eating chocolate is a significant improvement on that problem...
 
I read "I need to stop eating myself stupid" as "I need to stop eating myself, stupid" at first
Further demonstrating the English language's horrible syntax rules
 
Thanks for the OCD
 
11:48 PM
@user1131997 Again?
Mar 15 at 11:07, by sehe
@user1131997 Duh. Mysql is freakin' open source, remember
I wonder what open source project he'll be picking next time to 'wonder about'.
Such useful endeavors. Really commendable
By the way, for context:
5 hours ago, by user1131997
@MooingDuck yeah, I always forgotten about GCC , that it's open source, becuase I'm using Windows and C++ compiler, which is closed, so always forget about GNU products
 
@sehe Hehe...I run in to problems with defines on mingw all the time. It's irritating, but I tolerate it so I can actually have mingw
 

« first day (524 days earlier)      last day (4425 days later) »