« first day (441 days earlier)      last day (4507 days later) » 

12:00 AM
although I still have no idea how it led to the internals of the unordered_map dying
 
sbi
When I did an internship in the 90s, I spent ten working days (plus a lot of overtime) trying to find out why my application was unable to communicate with an external device via a COM port. I found a lot of errors in the code looking for that one bug. When my boss dragged the big oscilloscope into my room to tap the line and look what I'm doing wrong, the error unexpectedly disappeared.
I traced my last edits and found that I had swapped two lines of code, one of which initialized the COM port with the odd settings that device needed, and the other one default-initializing it with 8N1.
The slap on my forehead resulting from this hurt for days.
 
it should have just crashed on a bad memory dereference in the function
 
@sbi yep, that sounds pretty much like it :D
 
10 days? Jeez, how many unrelated bugs did you find?
 
12:02 AM
In the software? Or in the human-ware?
 
3, but one escaped.
 
lol
 
also, reminds me of one of my roommates... except he refuses to follow coding conventions.
then asks me if I know C++, and to look at his code.
 
sbi
@ShotgunNinja Dozens. But I was a pup back then, having had studied only for two years. They just paid me a few dollars for doing the work, and the boss took it in good humor.
 
12:03 AM
That's why every language should force the damn indentation.
 
I think I gave myself a minor concussion from the force of my palm hitting my head.
@sbi funny, that's where I am now in terms of education.
 
sbi
Somewhat fitting the current theme:
The easiest way to solve a problem is to deny it exists. #asimov
 
lol, nice
 
*goes to follow on Twitter
 
Xeo
Yeeeeeeees
 
sbi
12:05 AM
I read that while I was waiting for @Xeo to turn up a few hours earlier.
 
Xeo
my resource management system works with allocators now T__T I iz so happy
 
@sbi the problem doesn't go away doing that though
 
sbi
@Xeo You only think it works now, because you lack sleep so badly. Look at it after a good night's, and you'll be horrified. :)
 
I tried that with my hurting feet
they didn't stop hurting because I denied the pain existed
 
Xeo
No, it really works, it's passing my tests. :)
 
sbi
12:06 AM
@TonyTheLion It doesn't need to, because there is no problem.
 
@TonyTheLion Try harder.
 
sbi
@Xeo Oh, you should have a look at those "tests" tomorrow.
 
oh like that
 
sbi
@TonyTheLion Pain? What's that? Never heard of it.
 
Xeo
@TonyTheLion To do that, you need to hurt yourself somewhere else. Like, pinch yourself in the arm. That makes you forget about the pain in your feet
 
12:07 AM
@EtiennedeMartel I'd like to see you break your leg, and then deny the fact that it hurts and see if it still hurts
 
that reminds me
 
@sbi It means a period of heightened sensory input.
 
I promised myself I'd get a decent night's sleep today
 
@Xeo I'd have to seriously pinch myself...
 
@TonyTheLion Meh. I would probably try, fail, and then whine all day about how my leg hurts.
 
12:08 AM
doesn't look like it's gonna happen
 
But, breaking your leg isn't actually a problem. It comes naturally
 
@EtiennedeMartel oh...
 
Also, pain isn't a problem. It's a reality
 
sbi
@ShotgunNinja Oh, that! It's between birth and death, right?
 
you can deny that pain exists
 
12:08 AM
@sehe It's part of a regular process called "character-building"
 
it's called codeine
 
There, I denied them, successfully. Problem solved
 
Xeo
@DeadMG Me too. I want to code, though.
 
@sehe it poses a problem in an area of the body which you need all the time
 
Xeo
Seems I'll just miss new years while sleeping
 
sbi
12:09 AM
@DeadMG You should try to get sleep tonight, not today.
 
like a foot
 
Real men just clench their teeth.
 
@sbi well, it's a part of the waterfall.
 
true, but I don't give a shit about new years
 
Xeo
Wait, wtf? It's already 1am?!
 
12:09 AM
@sbi That's probably true.
 
@EtiennedeMartel Ok, how about you broke your teeth :)
 
@TonyTheLion You're a programmer, you don't need your feet. Let alone your legs.
 
speaking of which, I'm off
night night everyone
 
@sehe Clench your gums then.
 
Xeo
@DeadMG See ya in an hour
 
12:09 AM
lol
 
@EtiennedeMartel well, in life in general, when I'm NOT programming, I do occassionally need my feet
 
sbi
@EtiennedeMartel ROTFL!
 
Xeo
@EtiennedeMartel You don't increase your productivities through typing with your toes?
 
I need my feet to interface with my car, which drives me to work.
 
@Xeo I'm already unproductive enough.
 
sbi
12:10 AM
@EtiennedeMartel Aren't programmers supposed to go to the loo?
 
A stoma (Greek - pl. stomata) is an opening (a direct translation of the Koine Greek would be "mouth"), either natural or surgically created, which connects a portion of the body cavity to the outside environment. Surgical procedures in which stomata are created are ended in the suffix '-ostomy' and begin with a prefix denoting the organ or area being operated on. In anatomy, a natural stoma is any opening in the body, such as the mouth. Any hollow organ can be manipulated into an artificial stoma as necessary. This includes the esophagus, stomach, duodenum, ileum, colon, pleural cavity,...
 
@sbi Technically, yes. In practice, you can just code on a toilet.
 
Xeo
Btw @sbi, is the code to your sladders game open source? I'd like to take a look at it :)
 
sbi
@sehe Keep your teeth up, and clench your head!
 
I'm definitely using Stoma as a class name at some point.
 
12:12 AM
so I should go to bed
 
or Stomata.
 
but first I have to finish my beer
:P
 
perhaps in some robot project...
 
sbi
@Xeo I hadn't thought about this, to be frank. I don't think there's any harm in giving it to you, though. Ping me per mail, and I'll send it to you.
 
sbi
12:15 AM
 
Oh. That would have been better, yes.
 
sbi
Eminem under a kid's bed. Now there's a scary thought for a parent.
 
It's scarier if he's under a kid's bed with that face.
 
@Xeo I do in fact have this currently in my work setup:
 
Xeo
oO
 
12:17 AM
I think that's Eminem's Poker Face
 
sbi
@EtiennedeMartel Does he have others to swap in?
 
Xeo
@sbi Done.
 
sbi
@Xeo You want me to do this now?
43 mins ago, by sbi
@Xeo Ugh, code. I guess I'm too tired now, but I made this 242nd open tab to look at Real Soon Nowâ„¢. :( Feel free to remind me...
 
Xeo
12:19 AM
xD
 
@sbi are you reminding yourself? Sounds like that could get tedious pretty quickly.
 
Xeo
@sbi No, it can wait until you have time, no worries
 
sbi
Jeez, I got 68 out of 78. We actually have sites I only heard about for the first time on Sporcle. http://www.sporcle.com/games/rchern/stack-exchange-sites
78 SE sites?! Holy shit.
 
Xeo
SE sure has grown...
 
sbi
@Xeo Groan.
 
12:23 AM
It sure seems to be working well for them.
 
sbi
Anyway, gotta go to sleep, too. I almost fell asleep in the S-Bahn on my way home already...
'night!
 
See ya!
 
Xeo
G'night
 
C++11 doesn't have a typesafe printf, does it?
 
Boost.Format.
 
12:31 AM
I always use streams
stringstream
 
streams? they're not precisely a replacement for printf.
 
Streams aren't all that great for formatting.
Manipulators are rather verbose.
 
and boost format is a little of a mouthful now that there's variadiac templates, isn't it?
 
boost::str(boost::format("...") % a % b % c)
 
wikipedia has a simple implementation: en.wikipedia.org/wiki/Variadic_template
 
12:33 AM
You could easily do variadic template version.
 
so what can formatters do that you cannot do with a stringstream?
 
it's a little bit relying on runtime still though
and has a bug (an excess ++s) but nonetheless.
 
@TonyTheLion It's not an issue of capability, it's an issue with verbosity.
 
@TonyTheLion the printf fashion just feels more fluent than streaming strings.
 
@wilhelmtell Technically, you can stream anything, not just strings.
 
12:34 AM
@wilhelmtell oh I don't like the printf thing at all, with all the % symbols
meh
 
@EtiennedeMartel i know, same with variadic printf.
 
mystream << someiint; looks much better then printf("%d", someint); imo
 
Only for trivial cases. Add more formatting and the stream syntax collapses.
 
Xeo
formatting sucks bad for streams, aye
 
hmmm, never had to add formatting though... so perhaps that's the reason I'm clueless
 
12:36 AM
@TonyTheLion sometimes. sometimes not. sometimes what you're trying to say is "print an integer" and the value of the integer is a technical detail. it's a matter of where the focus is in the statement.
 
@CatPlusPlus +1
 
it depends on whether the focus is on formatting the output or the content of the output.
but the wikipedia implementation is not ideal
it's not performant. it does runtime checks.
 
Well, let's write one then.
Still, I don't know if it would be possible to avoid runtime checks with the traditional "format string" approach
Not without compiler support.
 
ok well you can't get away from the runtime checks. i guess printf' flavours are inherently slower than streams. same with boost format.
compiler support can't help you either.
unless there'd be a way to only accept literal strings. and there is no in C++.
so you have to defer the parsing to runtime.
streams don't have this problem. there is no parsing.
but streams have their own performance issues.
 
Depends. For a file stream, I doubt that it's the actual bottleneck.
 
12:44 AM
Bah. You're doing formatted I/O. Performance is somewhere on the bottom of the drain, anyway.
 
For string streams, yeah, but then a stringstream has to manage its own buffer, unlike sprintf.
 
no, just strings.
 
Boost.Format with variadic templates.
 
user406009
They should have chucked boost::format into the standard.
 
2:36 AM
@jalf Concerning STM: would it make sense to implement copy-on-write on certain classes to reduce the cost of copying?
@jalf The GameStateNode class is a tree-like structure. A copy of the root node could potentially involve a 2GB copy. Depending on the size of the AI search tree.
 
 
2 hours later…
5:04 AM
@CatPlusPlus I like C. It feels like a really clean language.
 
Sure, if you mean "it cleans your colon."
 
@keithlayne I have no idea what that is supposed to mean.
 
@Max it means exactly nothing, just like everything else I say :)
 
@keithlayne That's impressive. Most things I say mean infinitely close to nothing, but not exactly nothing.
 
5:07 AM
watch and learn, young Jedi
 
5:58 AM
^ Eros Entropic Tundra. In other words: forever alone.
I think Satanic Panic in the Attic deserves a place in the top 5 album chart for the 2000 - 2009 decade.
 
6:26 AM
Drivers are such a hassle.
 
user406009
Hmm, it seems that firefox not only likes to allocate alot of ram in it's own process, but it also loves allocating tons of ram in xorg.s8.postimage.org/r6fjsak2b/blah.png
 
Oh, dear.
 
7:05 AM
So bored...
 
 
2 hours later…
sbi
9:02 AM
40
A: What is the coolest thing you can do in <10 lines of simple code? Help me inspire beginners!

ThibThibThis C-code is maybe be obfuscated, but I found it very powerful #include <unistd.h> float o=0.075,h=1.5,T,r,O,l,I;int _,L=80,s=3200;main(){for(;s%L|| (h-=o,T= -2),s;4 -(r=O*O)<(l=I*I)|++ _==L&&write(1,(--s%L?_<L?--_ %6:6:7)+"World! \n",1)&&(O=I=l=_=r=0,T+=o /2))O=I*2...

 
@StackedCrooked well, then you'd have to reintroduce conventional locks, which is what STM tries to make unnecessary. What I think would be preferable would be to, instead of putting one huge data structure into a shared<T>, make the data structure STM-aware, so that it can internally create transactions to modify/replace/whatever individual nodes. So from the user's POV, it doesn't need to expose any STM stuff, but it uses it internally on the specific nodes that need to be accessed/updated
Especially for a tree structure that should be fairly easy to do. Internally each node can just have type shared<Node>. Then the tree class just needs to open and commit transactions on those
 
 
1 hour later…
Xeo
10:09 AM
Morning
 
11:09 AM
if I wanna do something like this std::shared_ptr<double> p(new double[42]), how do i do it?(beside using a container)
 
@bamboon you really should use std::array
 
hmm but doesnt have std:.array a fixed size?
 
@bamboon sure, your example also has a fixed size, even without the 42 literal
 
@rubenvb but how does it have fixed size if I replace 42 with a variable?
 
@bamboon true, I'm confuzzled today :)
 
Xeo
11:17 AM
@bamboon std::shared_ptr<double> p(new double[42], [](double* p){ delete [] p; });
you have to supply your own deleter to use the array version
 
but then the question becomes: why the hassle?
 
@rubenvb ah ok perfect thanks
@Xeo yeah thanks, read that in the link
@rubenvb more or less some theoretical testing
 
Xeo
@rubenvb If the array is really big and you want shared semantics (and don't change the size of the array), a shared_ptr is the best standard way, because std::vector will perform copies.
If you want both shared semantics and be able to change the size of the array, your best bet is a std::shared_ptr<std::vector<double>> p(42);
 
@Xeo Ok, fair enough, but I'd just RAII the sucker and pass around references, but I can see the lifetime of a large object perhaps becoming problematic that way.
 
Xeo
@rubenvb That doesn't solve the shared semantics problem
You want to destroy the array when the last reference dies
 
11:26 AM
@Xeo hence my comment on lifetime :)
 
 
1 hour later…
Xeo
12:48 PM
1
Q: Map data structure in C++

user1124281I need to create a map of vectors. The first vector contains a list of strings and the second vector contains a list of integer IDs. Is this possible?

I don't get how questions like this can get upvotes. :(
 
1:00 PM
suddenly I realized that I can use multiple inheritance to crack god-class to independent parts
sometimes I like this language
 
1:14 PM
mawning
 
@Abyx Have you looked at policy-based design?
 
@StackedCrooked it's too complex
 
I guess you're right. I've never really used it successfully.
 
I prefer composition
 
I've been thinking whether it can be simplified by simply inheriting a single templated policy class which can be specialized per case. E.g. template<class T> class Policies; class MyClass : public Policies<T>{};
 
1:24 PM
me too, but I have a lot of places in code which uses members of this god-class, so I can't use composition now
 
God classes aren't healthy. They tend to incite religious wars.
 
If you look at memory layout then inheritance is very similar to composition. And you have the benefit of the zero-size optimization.
 
composition is way less brittle than inheritance
 
Xeo
Hey @DeadMG, any comment on your comment to my answer here?
 
done
 
Xeo
1:37 PM
@DeadMG I still don't know what you mean. I std::move everything inside. Or do you meant if the lhs is an aggregate type in the first comment?
 
no
just because you move everything inside doesn't mean you didn't make a billion redundant copies in the operator parameters
imagine something like path p, q; auto x = p + q;
you copied p and q when you didn't have to
 
Xeo
I do, I copy the data inside anyways.
It's just that I can now move the copied data
 
no
 
Xeo
to create x, we need to copy both the data of p and q. I can just do that in the parameters for copy elision.
 
that's only true if the lhs's vector has enough space to make room for the rhs's data
else, you have to copy again when the vector reallocates
whereas if you took by reference, you could prevent that from happening
 
Xeo
1:41 PM
AH, I see what you mean now
path& operator+=(path other)
{
    path_.reserve(path_.size() + other.path_.size());
    std::move(other.begin(), other.end(), std::back_inserter(path_));
    return *this;
}
If the reserve here reallocates, taking the lhs by value was for naught
Hmhm
 
hi! could somebody point me to a really nice DLL implementation in C?
 
@NikiC What do you mean by "DLL"?
 
doubly linked list
I know it's trivial to implement, but some of my code currently is quite ugly and I'd like to see some clean reference implementation ;)
 
it's in C
there's no such thing as a non-ugly implementation of anything in C
6
 
You mean like I should ask for C++? I don't care much about that, both languages are pretty much the same to me ^^ (from a non C(++) programmer perspective)
 
1:55 PM
well, let me give you a hint
C++ is an extremely different language to C, and vastly superior
for a start, it comes with a doubly linked list std::list<T>
 
@DeadMG Is the code for that available somewhere?
 
you can just look in the <list> header file
no guarantee that it's especially readable, though
if you want to roll your own doubly linked list for no useful reason, then you can simply use unique_ptr, which makes it fairly trivial to implement
 
@DeadMG Yes, I want, with the unuseful reason being that I'm not using C++ but C ^^
 
well then it's your own fault
or the fault of whatever external factor, e.g. idiot manager, enforced such choice upon you, I guess
but it's a simple fact: C sucks. Don't waste your time dealing with it
 

« first day (441 days earlier)      last day (4507 days later) »