« first day (1040 days earlier)      last day (3916 days later) » 

2:02 AM
yes.
IME Programmers is a toxic hole full of oop-crazies and it doesn't help that half the people there are those guys looking to ask totally off-topic questions because SO closed them as OT.
 
@Pawnguy7 It's more about closing than downvoting. I haven't added up recently, but at one point counted between two thirds and three fourths questions being closed.
 
0
Q: Should stackexchange implement this into StackOverflow?

AlizterWe should implement his into stack overflow: if (user.Rep < 10 && question.Text.Length < 100) { throw new NewUserException("Not again", user); } mean while... try { QandA.Run(); } catch (NewUserException e) { e.User.GetLastQuestion().Comment("Please read stack overflow rules and ot...

^^ lol
 
-1 for terrible programming language. — DeadMG 5 secs ago
 
I have never quite gotten where the difference was between SO and programmers. Is programmers sort of... development practices, while SO is more... Q&A?
 
@Mysticial did you see the robot's question?
 
2:08 AM
lol, it's so obvious that we Lounged that meta post.
@Borgleader yeah
 
You can catch exceptions by reference? I never even thought of using it beyond how I was first taught. That works?
 
of course it does
 
@Pawnguy7 Therein lies the major problem: nearly nobody's sure what's really topical there -- and the five who do know are all in vehement disagreement with each other.
 
what would be the point in deriving from exception base classes if they didn't?
 
@Pawnguy7 No one knows the existence for programmers I bet
 
2:10 AM
@Pawnguy7 Not only can, but normally should.
 
@DeadMG Can you expand on this? I don't see your reasoning.
 
@Pawnguy7 Why the fuck would anyone derive from an exception base class, if you cannot use that class in it's primary function in a polymorphic fashion because you can't refer to it in an exception handler?
 
Do calls on a sliced object not behave in a polymorphic fashion?
 
@Pawnguy7 A sliced object turns into the object it is sliced to.
So no, it's no longer polymorphic.
 
@Pawnguy7 Of course not.
if you have a value of type T, and you call t.f(), the only function that can ever resolve to is T::f().
 
2:17 AM
Though I dunno if the sliced portion gets destructed properly or if it's just UB.
 
that's the nature of it being a value.
@Mysticial It does.
slicing is more of an emergent property of RTTI and the way references are handled, rather than any explicit wording in the Standard.
 
@DeadMG So the sliced fields have their destructors called on each one?
 
@Mysticial Of course.
 
And the child's destructor is not invoked I assume.
 
wait, wait.
 
2:19 AM
Oh. In that cases, it makes sense. Now I am just wondering why polymorphism only works with references and pointers :\
 
what are you talking about?
slicing is a copy operation, nothing more, nothing less.
it's just that the destination isn't of the most derived type and the reference to the source is implicitly cast to the base, thus matching the copy constructor.
slicing doesn't entail any strange runtime behaviour different to any other copy of any other type.
 
@DeadMG Well actually. Suppose I did this:
A inherits from B

A *p = new B();
A x = *p;
 
@Pawnguy7 Simple. If I allocate a region of memory big enough for T, how the fuck can I put a type derived from T that requires arbitrary size and alignment in that space? The memory isn't big enough or correctly aligned, and can never be.
 
When you deference it from the parent class, how does the compiler know to destroy the sliced fields?
 
@Mysticial It doesn't. You leaked the dynamic object you allocated.
when you do A x = *p; this is just a copy like any other.
*p is an A& and the copy constructor is called.
and the source object, when viewed as an A, is copied.
 
2:22 AM
@DeadMG Well, I haven't leaked it yet. I still have the pointer p.
 
@Mysticial Well, arguably true. But you would have to take care of destroying it yourself.
 
Or rather. I'm not leaking anything. Just slice-assigning.
 
there is no such thing as a slice assignment.
 
@DeadMG Or whatever the term is. I'm not a pedant.
 
2:23 AM
a slice is two operations- implicit cast from Derived& to Base&, and then Base::Base(Base&). That's it.
there's nothing special about slicing.
 
why would you actually want to slice?
 
the compiler does not contain any code special to slicing.
@A.H. It's almost always an accident.
the slicing thing is why a lot of so-called modern languages don't permit values to also be polymorphic types.
 
So if you make the copy-assignment operator virtual...
Or does that even make any sense...
 
no.
no, it most assuredly does not.
 
Don't make concrete base classes :P
 
2:26 AM
when you do A x = *p; then a must always be of type A, no more, and no less.
it can never be anything else.
so A x = *p; can only compile if *p is going to match one of A's constructors.
and since the type in this case (A) is fixed, virtual won't bring you anything at all.
 
@DeadMG I guess I have always thought of pointers pointing to a base instance, not the combined base/derived. I guess as it turns out, it, like other untested assumptions, were incorrect.
 
@Pawnguy7 A base* does point to a base instance. There's no other way that a base* could possibly work.
 
Alligned with a derived?
 
what?
 
he means a base pointer to an instance of derived which is a base instance
 
2:29 AM
For inheritance, does the derived point back to the base, i.e. the base knows nothing about the derived, or is it the other way?
 
@A.H. No, it just points to the base instance.
@Pawnguy7 The base knows nothing about the derived.
think of it this way
if you have a Base*, then that points to a Base instance somewhere in memory.
 
@DeadMG yeah, but I guess he meant like Base * p = new derived(...)
 
the full chunk of memory it is subsiding in could have any size or alignment. This abstraction is why pointers and references can be polymorphic.
@A.H. In which case, p points to a Base.
on the other hand
 
yeah , the base class is not concerned with what lies after it in memory
 
when you have a value of type Base, then the chunk of memory it is subsiding in must have sizeof(Base) and alignof(Base).
which clearly leaves no room for any derived class.
 
2:31 AM
and thus slicing was born
 
eh
slicing is really born from implicit downcasting from Derived* to Base*.
that's what makes slicing accidentally possible for people.
well, for you humans anyway
people like me never make such mistakes
 
is the vtable preserved in a slice?
 
So if a pointer to a derived still, in reality, points to a base - which makes sense.
 
or just a call to the copy constructor I guess
 
puppies cant code -_-
 
2:33 AM
Doesn't the base NEED some sort of reference to its derived? Otherwise, how do you reach it?
 
@Pawnguy7 No. A pointer to a derived points to a derived.
 
@A.H. It gets replaced with what it slices to.
 
@Pawnguy7 It's pretty simple.
 
@DeadMG Base pointer to a derived, is what I meant to say.
 
It's another example of C++ doing something behind your back so that when you shoot yourself, you don't notice it until you're bleeding all over the place.
 
2:34 AM
@A.H. Yep. There's no way that a vtable could possibly be preserved from the source. The vtable must always match the final type.
 
@Pawnguy7 same memory address
 
@A.H. Nope.
that's popular but far from always possible.
to understand how this works, let's consider a base and derived class, where both have some virtual functions.
for each virtual function in the base that Derived overrides, the Derived class places it's own special function pointer in the vtable.
now, when that function pointer is invoked by a virtual call, the Base* pointer is passed along to it.
for our Derived class, we know where in the Derived class the Base instance lies- say, it's 4 bytes in. So all we have to do is subtract 4 from the pointer, and voila- a valid Derived instance.
 
@DeadMG so dynamic_cast could actually change the pointer value ?
 
absolutely.
and there are a number of situations where it basically has to.
 
compiler or platform dependent ?
 
2:38 AM
eh, not really.
virtual inheritance means it will almost certainly have to because that shit is just a fucking mess.
 
@DeadMG I am guessing in the case of virtual inheritance a pointer to the virtual base is kept in vtable or something similar ?
 
then you also get side-casting and stuff.
 
Sigh. I get why it is useful, but I always seem to fail to understand how.
 
@A.H. What? No. Then you'd need 1 vtable per instance.
you don't want to get into the mechanics of how dynamic_cast works, trust me.
 
is this explained the C++ programming language book ? :p
 
2:40 AM
almost certainly not.
well, some of it will be- only pointers and references can be polymorphic is important, and avoiding slicing is too.
but you certainly won't find implementation details there.
 
if you want them, you'll have to read the Itanium ABI specification, for example.
 
@StackedCrooked huge onebox
 
or speak to some poor fuck like me who did, in fact, have to read it.
 
2:43 AM
you read that book?
seems interesting
 
no, the Itanium ABI specification.
 
@DeadMG I tried looking at an ABI before , quickly realized my mistake
was something about calling conventions for x86_64
 
The really depressing thing is that I need 125 rep to downvote so I couldn't downvote your question. But let me give you a hint: .
 
:11351254 You're asking a DSP question in the C++ room? I don't see any C++ in that question.
 
during another mistake of actually trying to code stuff in assembly
 
2:44 AM
calling conventions are pretty tame in comparison.
put parameter X in register Y or on stack in order Z.
 
yes but remembering the order (got confusing when floats got involved) was hard for me
 
that's why sane people write a program to pass the parameters for them :P
 
hehe
 
3:03 AM
@DeadMG Basically any multiple inheritance, virtual or otherwise, it can end up having to adjust this.
 
yep, it's pretty messy really
 
@JerryCoffin adjusting this?
 
-1
Q: How to deal with Mods deleting legitimate questions?

user2701084In order to provide evidence that i am no joke. i will show you how to start your own google. first go to alexa.com, which is owned by amazon, they provide a downloadable cvs file with the top 1 million web sites in the world. but only URLS but updated daily, but owned by amazon. and amazon is ...

 
@MarkGarcia 1 rep questioner answered by a 1 rep user.
 
Just two things: new user trolling or old user trolling.
 
3:11 AM
@MarkGarcia Wow, ironically deleted.
 
Hi can someone please give me a hint why this lambda is not working? i thought if I explicitly say it returns a string, it should work with cout?

cout << []()->string { return ""; };
 
@StackedCrooked Access to member data is normally via an offset from this. With single inheritance, this points to the beginning of the object, with base class members first, and derived class members after that. With multiple inheritance, however, you can't start both (or all) base classes at the same place. To make up for that, the compiler adjusts this to point to the beginning of the object you're working with, so you'll get the correct offsets from there.
 
@Rapptz Yeah. Though it's not "legitimate". :)
 
@Oleksiy Didn't call it
 
@Rapptz sorry what do you mean?
 
3:13 AM
A lambda is a function.
You didn't call it.
 
@Oleksiy cout << []()->string { return ""; }();
Notice the ().
At the end.
 
@Rapptz Yeah I tried that, but it still says no operator found which takes a right-hand operand of type 'std::string'
@Rapptz never mind!
#include <string>
thanks :)
 
Don't use using namespace std.
It's a bad habit.
 
@Oleksiy Just keep practicing decrypting error messages. :)
 
3:27 AM
@Rapptz speaking of that , Is putting an include directive in a namespace considered common ?
like namespace system { #include <arpa/inet.h>}
 
@A.H. No, it's not common. It can break things completely because the "stuff" that's declared in the header is now being declared as members of the namespace. Since they weren't defined there, linking won't work. Still works if everything in the header is declared as extern "C" though (automatically puts the name in the global namespace).
 
@A.H. Robot asked a question about this like 2 yars ago
 
@JerryCoffin :< would have been nice
 
Only use case I can see if you want to include a header but don't want to expose it to the public API
something like namespace detail { #include "stuff.hpp" }
 
@Rapptz But even then, what if that header includes iostream and yours is the first included?
 
3:48 AM
awww the robot's meta post is on hold :(
 
Why do most of the SO mods suck?
Serious question
Is it the busy aspect of the job? Is it the fact that they appeal to the group of meta so I tend to dislike them? I don't know
 
it's because they spend too much time and energy on upholding the rules rather than doing what's productive
 
They're too lazy busy to make any changes.
Or improvements, that is.
 
This comment made me wonder
I think it's time to censor this. I'm all for free speech and all, but we just can't have this sort of off-message post hanging around here. (I can't wait until someone quotes this out of context! When it happens, I win Teh Intarwebz!) — Andrew Barber 46 mins ago
 
Well it would have been put on hold mod or not. Hell he's not even the mod who put it on hold. animuson did.
 
3:59 AM
I'm.. not upset at the fact it's on hold lol
 
Well I'm not sure what you meant then =/
 
well
I'm going to attempt sleep
wish me all the lucks
 
Good luck.
 
4:15 AM
animuson is pretty well known for being a deletionist on meta.
And he regularly closes and deletes all the fun stuff.
 
Kon
I, for one, voted for the other guy.
 
@Mysticial so... he's a party pooper?
 
@Borgleader Yes. VERY much.
Woah... I just got an amazingly old accept.
 
TIL Windows 8's clock mechanism is out of sync. (extremetech.com/computing/…)
Another reason not to upgrade.
 
@Mysticial how old?
 
4:21 AM
@Borgleader The mods are horrible.
They delete things they don't like, it's preposterous.
 
Not all, minitech is cool
 
Everyone on meta always seems to have their panties in a bunch
I mentioned earlier that I said most, not all.
 
boltclock is cool
 
i think the problem lies in the fact that there are very few and they get easily annoyed
 
I think BoltClock is cool too
 
4:22 AM
They're just upholding the their rules.
 
and I used to think Shog9 was bad but he isn't anymore
 
kinda like us when people ask for x language question in the lounge because "the other room was empty"
or because "its not fit for so" , or "its urgent"
 
I voted for Andrew Barber and I ended up not liking him at all
And animuson sounds like he's horrible.
Oh.. and.. Gordon.
 
I forgot who are the mods I've voted.
 
@Borgleader 2 years almost
 
4:25 AM
wow...
i think i mightve voted for minitech but frankly i dont remember
 
TBH, I remember that I didn't vote for minitech, and now I somehow regret that I didn't. :(
Meta Meta Stack Overflow.
 
were discussing mod suckage
 
Markup sucks.
 
yes
@Rapptz Have you seen Micheal Clayton ?
 
No
 
4:36 AM
@Borgleader s/ea/ae/, I suppose. Though inb4 I usually use "Micheal".
 
yes ae, oops
 
@Rapptz Please don't tell me you're taking it seriously.
 
@JerryCoffin No I'm not.
Was just an afterthought sparked by the comment
 
@Rapptz It does sound like he might be hinting toward just the tiniest bit of sarcasm toward a few of his fellow mods.
 
I'd like to be mod for a day. So i can play whack-a-mole with all the terrible questions. You get insta-closed, you get insta-closed, all the terrible questions get insta-closed.
 
4:45 AM
@Borgleader Sounds like a mod. :P
 
Dude I,d be an awesome mod.
 
The more I see it, the more I think we did things right on the Fidonet C and C++ "echo"s. A mod gets elected for one year, then somebody else takes over the position. Doing it for too long just burns people out -- it's probably a little less pressure here, but it's still a serious amount of work, and I'm pretty sure almost everybody is better off limiting the time the spend doing it.
 
It might be less pressure if there were more mods. plus they could take vacations
I think Mysticial was telling me the ratio of mods per active users is a lot lower on SO than other SE sites
or maybe I misunderstood
 
5:01 AM
@Borgleader No, I believe that's accurate -- but on many sites, for the ratio to be as low as it is on SO, you'd end up with only a small fraction of one mod. :-)
 
lol
So sad, Ubuntu Edge is at 12 of its 32M dollar goal :(
it's a really nice piece of phone
 
5:25 AM
MAD4JERRY
 
You're both mad!
 
5:43 AM
Guess I'll watch Michael Clayton now
 
Xeo
Wheee, time for a work-sponsored gamescom trip.
 
@Xeo Sounds like fun.
 
@Xeo you lucky bastard =/ (i mean that affectively affectionately of course)
 
@Borgleader "affectionately" perhaps?
 
err yes
i forgot how to english
0
Q: Declaring Variables and commands from text file to c++

user2702309How can you declare variables from a textfile? Example: sample.txt : int num1 int num2 -How will you then read that sample.txt in c++ in such a way that two integer variables(num1 and num2) will be declared in c++? We are in the topics of stacking. But so far I have no idea how to do this. T...

I'm not sure what he's trying to do =/
 
5:58 AM
@Borgleader Have you also forgotten how to link your replies?
 
@Borgleader He's trying to create a variable at runtime.
 
@JerryCoffin No I deemed it not necessary to link because it was right under and the conversation is currently pretty slow.
 
@Borgleader Looks to me like your comment is pretty accurate.
@Borgleader Yes, but I'm doing other things, and would notice your answer a lot faster if it pinged me.
 
@JerryCoffin Ah ok
 
I h8 cppnetlib
 
6:15 AM
is there a special function if the body is xml or something?
 
It's pretty boring so far
 
@A.H. So why don't you use something else (e.g., ASIO)?
 
A movie with a boring beginning is probably boring the whole time
 
@JerryCoffin didn't feel like parsing html headers
 
@A.H. Hmm...fair enough, I guess.
 
6:20 AM
seriously though wtf wireshark shows a valid response (validish request) and cppnetlib is still blocking
and the documentation is terribly organized
doxygen's would be far better
 
lol doxygen
 
> The images need to be in JavaScript format.
 
@Borgleader I prefer my images in pure functional format.
 
6:37 AM
Okay well Michael Clayton was pretty boring
I stopped after ~30 minutes
 
:(
Speaking of movies I should watch blade runner again, the right version this time
@FlorisVelleman Oh btw, gratz on 2k rep
 
@Borgleader Thanks :D
 
Could anyone tell me what's wrong here?
I was just testing if I could do something akin to this but it seems I can't? Or am I doing it wrong
Oh wait, oops.
 
Yeah simple syntactic error on my part
Hm :/
 
6:47 AM
 
@Borgleader All the versions are right -- just some are more right.
 
OK. We really need Lounge<Chat>.
 
I wonder if there's a way to store temporary template classes as a class member :s
I've been picking my head over this for a good 10 minutes but I can't think of anything that isn't any or a void pointer.
 
Depends. Though I think a base class should do the job.
 
@MarkGarcia WTH?
 
6:49 AM
@MarkGarcia Yeah me too.
 
@wilx Yeah. And I wonder what's that green adapter.
 
@MarkGarcia it looks like PS/2 to USB
thats the only round connector i know xD
 
Parallel port adapter -> parallel to serial -> serial to ps/2 -> USB. I think.
0
Q: Is it possible to write C/C++ and run them on windows?

SamirThis is probably a dumb question, but i've looked everywhere, and It doesn't seem I can find a solution, so I decided to come to the one place where questions always get answered, so, Is there any way whatsoever, that I can write C/C++ on my windows?

Damnit. I wish I have a camera and a dusty window here.
 
@Rapptz Ah. So you just want to have a temporary to be passed.
 
6:53 AM
You have looked everywhere? Really? — Borgleader 32 secs ago
 
@MarkGarcia yeah.
 
But I don't see any delete. :(
 
@MarkGarcia I think you skipped one (I'm guessing the black is a DB-25 to DB-9 serial).
 
like I said, disregarding memory.
I wish there was a better solution
 
@Borgleader lol. I wanted to say that.
 
6:54 AM
@MarkGarcia I can store them all into a container that would basically own all of them.
And it'd take care of the deletion.
 
@JerryCoffin Ah. The shorter parallel port. (That's really how I remember it) :P
@Rapptz I can't think of some good solution for I don't really understand what you're really trying to do. Still, I think dynamically allocating an object isn't necessary.
 
I want to have a class be able to store a template class
 
@Rapptz Or maybe use std::unique_ptr.
 
stuff like a<int> or a<float> or a<whatever>
 
Oh.
 
6:57 AM
you can't do class a { template<typename T> stuff<T> var; };
and I don't want to do template<typename T> class a { };
 
@Rapptz Do you mean store the type of object produced by instantiating some template?
 
Hmmm... I had a similar problem once. I finally succumbed into templating the enclosing class.
 
"what-to-do-about-underage-coders-on-so-making-us-the-old-farts-look-like-pedos" it got deleted so fast :(
 
rofl wat
 
7:00 AM
@JerryCoffin I want it to store the data somehow that the template class has.
 
@FlorisVelleman What?!
 
@FlorisVelleman do you have a link so someone with 10k can screenshot?
 
How the hell does underage coders have to do with pedophiles?!
 
Not sure lol
 
7:05 AM
 
@Rapptz Based on what I understood so far, I think you should use CRTP and make set virtual.
 
I don't really see how CRTP would help here
 
wohoo ! libcurl rox
 
@JerryCoffin That's a repost but with a different title.
 
@JerryCoffin xdotool? oh i recognize this... /cc @sehe our little friend is back (also thanks for the SS)
 
7:07 AM
@Rapptz Oh. Right. You want a base class.
 
@MarkGarcia I want to store a specific template class as a collection of them in a class :P
unique_ptr and friends don't work well with polymorphism do they?
or was that auto_ptr?
 
@Rapptz So a collection of as but those as have different template parameters.
 
@MarkGarcia Correct.
 
@Rapptz No problem with unique_ptr.
 
Morning
@Rapptz why shouldnt they?
 
7:12 AM
@Rapptz what makes you say that?
 
It was auto_ptr
not unique_ptr
@A.H. Because auto_ptr didn't, and I didn't know if unique_ptr did // @ArneMertz
auto_ptr sucked hardcore basically
 
@Rapptz it sucked only if you used it. Which wasn't a good idea :P
 
I think you should make make a perfect forwarding factory function.
Wait. They aren't deleted.
 
No virtual destructor on base class
 
Oh.
 
7:22 AM
That's a good example of why you need one.
:)
 
There.
Though you can't use set after it has been converted to base.
lol @ myself. Just tried to put default arguments to a perfect forwarding variadic function. facepalm
 

« first day (1040 days earlier)      last day (3916 days later) »