« first day (377 days earlier)      last day (4579 days later) » 

2:00 PM
manually. There aren't that many of them
so just make a list of the possible orientations of each
 
yea four possible rotations per tetromino
 
when it is rotated clockwise you just select the next orientation in the list, if counterclockwise you take the previous
 
right
 
that's how I'd do it anyway
 
sounds like a good idea
 
2:02 PM
@RMartinhoFernandes Okay. I am writing a list class. Any tips, trick or techniques for writing a list class?
 
sbi
@SSight3 Get yourself Effective C++ by Scott Meyers.
 
Like std::list?
 
sbi
@SSight3 Rule #1 for writing a list class in C++: Do not write a list class, because C++ already has one.
10
 
Als
Holler!
 
2:03 PM
@sbi Did. Couldn't really make sense of it. I prefer human readable syntax from humans.
 
Als
Why the Robot s in the room title?
 
@RMartinhoFernandes No. I don't think, lemme check it's implementation.
 
@SSight3 I don't blame you. Thinking is overrated anyway
4
 
Als
@SSight3: In simple words.You do not need to write a list implementation because C++ already provides one as std::list
 
sbi
@SSight3 Really, I'm at a loss for words. I have yet to read a C++ book as as accessible (and enjoyable) as Meyers' flagship.
 
2:04 PM
what header do I find trig function like sin in?
math.h?
 
@SSight3 Well, is it a linked list?
 
@RMartinhoFernandes Yes. But I'm just analysing if it fundamentally will act similar to list in the functions it provides.
 
Als
@TonyTheLion: Yes math.h if C++ AFAIK
 
sbi
@SSight3 If std::list is fundamentally different from your linked list class, then your linked list class is wrong. (No, I'm not exaggerating. std::list is the reference for how linked lists in C++ work.)
5
 
@Als I am obliged to challenge the form of tradition. It's good programming practice given any bugs or failures in the code will result in a huge mess. I've redesigned it numerous times and have learnt much in the process.
 
Als
2:08 PM
Oh I earned a bronze badge today on class tag
 
sbi
@SSight3 In order to challenge traditions, you should first get acquainted with them.
 
Als
@SSight3: If you are trying to do so for academic purposes or for just experience or learning, I would say that is fine, but if you are trying to reinvent the wheel I am afraid by the time you ride a car people are going to be flying in spaceships.
 
@sbi Not wrong. As edward de bono notes with lateral thinking, it is merely an alternative solution. It does not appear to have an append, find or remove element to it.
 
One of my students tried ++a today where a is an array... I should print "Arrays are not pointers!" shirts and coffee mugs.
 
2:10 PM
@FredOverflow But an array is a pointer... to an array of elements?
 
sbi
1 min ago, by sbi
@SSight3 In order to challenge traditions, you should first get acquainted with them.
 
@SSight3 what doesn't?
 
@SSight3 No.
@SSight3 std::list has all those operations.
 
@jalf List.
@RMartinhoFernandes Checking cplusplus.com it doesn't mention it.
 
@SSight3 So you're saying you think you can do better than std::list despite not even knowing what std::list is able to do?
 
Look further.
std::find.
 
You're going to learn so much more by learning how to use the C++ standard library
before you try to implement your own
 
sbi
@SSight3 Get yourself a good C++ book now!
 
Als
uhm after a long years of existence, someone who says std:list is not a List ahem..
 
@SSight3 std::list::push_back
std::list::remove
 
2:12 PM
Append?
 
Anything else?
 
Not merge. Append.
Like the "This sentence" + " is complete.", but in list format.
 
sbi
Really, if your list class does not behave like std::list, I won't use it. And if it does, I don't have any reason to use your list, which is far more likely to contain bugs than the standard one. Did I mention writing a linked list in C++ is a futile exercise?
 
Yes? Why do you think push_back does anything other than push an element onto the back of the list (== appending)
 
@sbi Numerous times. I like the idea people are opposed to my writing it.
@jalf But wouldn't that push_back the list itself and not it's elements?
 
2:14 PM
@SSight3 so you also like writing buggy software?
 
sbi
@SSight3 Well, then I won't waste anymore time on you. have a nice day.
 
Because that's another thing people are opposed to you writing
 
Als
Lol are we really debating over std::list being a good enough list now? Really?
 
@jalf Does not contain any bugs as far as I am aware.
 
@SSight3 HAVE YOU CONSIDERED LOOKING IT UP IN THE GODDAMN DOCUMENTATION?
 
2:14 PM
> Adds a new element at the end of the list, right after its current last element. The content of this new element is initialized to a copy of x.
 
@SSight3 lol....
I don't really know what else to say
 
Unaware of bugs being does inexistent make them.
 
other than that I'm willing to bet a hundred dollars that I can find at least one bug in it
 
sbi
@SSight3 See, you just didn't really make a good impression where your awareness is concerned. To say it politely.
 
@RMartinhoFernandes I have catchpoints that will intercept anything that is not what is expected.
 
2:16 PM
@SSight3 Ah, so you're willing to accept my bet then?
 
I have no idea what means.
 
@jalf Of course you would. Not complete yet.
 
sbi
@SSight3 That means that, rather than writing clean code, he catches exceptions. And thinks he can impress us with bloating about that.
 
@jalf I do not have a hundred dollars to spare. Perhaps something non-monetary?
@sbi It's my version of assert(). Basically it reports them for correction.
 
@SSight3 well, if there are no bugs in your code, what's the problem with betting money on it? :)
 
2:17 PM
@jalf Because I don't have any money?
 
you don't need any, if you're right.
Then you'll earn a hundred dollars
 
Asimov once said "At least, I would have wagered 15 cents, which is my betting limit on sure things."
 
what I'm trying to say here is that your code is buggy as hell, breaks with the conventions that users of it are going to expect, and that there is zero reason why anyone would ever want to use it.
 
@jalf And if I fail I'd be in debt by 100. Curious.
 
@SSight3 but you seemed pretty sure that there were no bugs, so how can you fail?
anyway, I'm heading home. :)
 
2:19 PM
@jalf Because it's incomplete presently. I'm merely querying design advice for improvements.
 
57
Q: How do I use arrays in C++?

FredOverflowC++ inherited arrays from C where they are used virtually everywhere. C++ provides abstractions that are easier to use and less error-prone (std::vector<T> since C++98 and std::array<T, n> since C++11), so the need for arrays does not arise quite as often as it does in C. However, whe...

 
@SSight3 Here's the only meaningful advice you can get then: start out with using std::list, and learn how it works and explore its interface fully (including the non-member functions). Then, when you know exactly what it does and how it does it, see if you can think of any improvements that'd justify writing a new list class
anyway, gotta run. See ya
 
@jalf Where would I peruse it's source code? I will comment... is it not implemented different come compiler to compiler?
 
Als
@SSight3: The purpose of writing your own list class is?
 
@SSight3 What exception safety guarantees does your custom list provide?
@SSight3 Just open the <list> header of your implementation(s).
 
2:27 PM
@FredOverflow And follow the breadcrumbs across until you find the real implementation :)
 
_M_dragons
 
Whoa, I just went into the kitchen and had maybe 1 second left before the milk "cooked over" (what is the correct term?).
 
@Als Experience. My first version ages back took over 2,000 lines of code and it did not work at all. 4 versions later and it's 259 lines for node+iterator, and about 500 (it's incomplete) for actual interface. I want to master the coding to such a level that I could implement node, iterator and list in less than 500 lines.
 
@RMartinhoFernandes I expect C++ programmers to be able to do that.
 
@Als If you're asking what role it will fulfill? Interconnected network of other classes that will rely on it for file writing, HTTP access, stringtokenisation operations etc etc.
 
2:31 PM
By the way, does anybody actually use linked lists in C++? :) My feeling is that everybody uses vectors instead.
 
Yes!
I had to write one a few months back.
 
Als
@SSight3: Okay, that is good learning experience. But the if you are claiming(I don't know if you are) your link list implementation is better in anyway than std::list then I will be compelled to say it is not true.
 
No, I didn't reinvent std::list. I needed a special kind of list (one with intrusive links).
 
@RMartinhoFernandes Oh, I tried that once. Did you encounter CRTP as well? :)
 
@FredOverflow Quit on first error. Maintain the state of the list until function is completed (EG if it quits same as previous state). I've toyed with the idea of atomic accesses. Error reporting (line, file, class, function, reason) on unexpected behaviour.
 
2:33 PM
And I know about Boost.Intrusive. But I needed move-only nodes, which Boost.Intrusive doesn't support yet.
 
@Als Which is why I must hope with every reason to try to prove you wrong. Because that leads one to excel.
 
@FredOverflow No, I don't remember using CRTP for it.
 
@SSight3 Okay, so your next project is cloning Microsoft Excel? ;)
 
I didn't implement a generic intrusive list.
 
@RMartinhoFernandes I had class MyClass : public IntrusiveNode<MyClass> or something. But it was in D, IIRC.
 
2:35 PM
@FredOverflow I could see the pun. I was going to tack in 'it might also lead one to powerpoint, depending'.
 
Als
@SSight3: I do not hope to be proved anything, I am happy with std::list :)
 
@Als Not even right?
 
@FredOverflow Yeah, but mine wasn't generic. Since it was an internal detail of another class, I didn't want any extra complexity.
 
Als
@SSight3: No I am afraid.But you can feel free to re-invent the wheel, build the bi-cycle,then the car and so on..just most of us would be riding pretty in our jets by the time you are done with the wheel.And then you can still say your wheel is better than what ours was,but then it wouldn't matter really,because we would be flying and you would be riding.
 
Who the fuck wants to be flying?
What's the point of making falls bigger?
 
Als
2:39 PM
@SSight3: And I really hope you get the gist from the analogy
@RMartinhoFernandes: Are you afraid of flying?
 
@Als I am afraid of falling.
 
...in love? ;)
 
Als
or in lust
;)
 
woof
 
Als
hello @DeadMG
 
2:42 PM
@Als The mastery isn't of the wheel itself, but the making of the wheel. My coding has progressed from 2,000 lines to less than 800. If I can write a list in less than 500 without bugs... I think I can skip the plane and go straight for the rocket ship.
 
reinventing the wheel is fun. You learn a lot
 
@Als woof
 
Now you want to riding hundreds of tons of highly explosive fuel?
 
@SSight3 The rest of us can do it in one line. std::list<T> var;. Done.
 
WTF is wrong with you people? Cars are already bad as it is.
 
Als
2:43 PM
@SSight3: As i said feel free too, I am not interested in the conversation of any lists anymore, Period. unless someone's thinking of paying for my Amazon wishlist, ofcourse.
 
@DeadMG Mere obfusucation. How many lines with the #include?
Two, lines, technically.
 
no, it's one per list plus one line
that's amortized O(1)
 
@DeadMG It won't compile without the #include.
 
meh
 
Als
@DeadMG: The argument is futile. You can try to wake someone who is sleeping,not someone who wants to remain sleeping.
 
2:46 PM
You just want me to justify your std::list obsession.
 
Als
no fuckin lists anymore!
 
My specialized list and some other stuff has less than two hundred lines: hg.tumtumtree.me/wheels/src/2d6732344b1e/include/wheels/… :P
 
everyone sees the world through their own eyes
 
@RMartinhoFernandes Singly linked?
 
Guys I need your help again
 
2:48 PM
@codemaker True.
 
@SSight3 No, doubly-linked.
@codemaker Not everyone.
Blind people don't.
 
I have managed to establish a connection between the client and server.
But I'm having trouble understand the difference between SOCK_STREAM and SOCK_DGRAM.
 
@LewsTherin news team; ASSEMBLE!
 
@codemaker sorry?
 
@RMartinhoFernandes blind people don't see anything
 
2:49 PM
@LewsTherin Without checking docs, I'm guessing SOCK_STREAM is TCP and SOCK_DGRAM is UDP.
 
@RMartinhoFernandes Indeed they are.
 
Als
Need to take off..later guys
 
@LewsTherin it's a line from the movie anchor man. Hit us with your question. We can take it.
 
@RMartinhoFernandes you are right. But I thought tcp divided stuff into segments? Why are they not packets?
 
@RMartinhoFernandes Double checked. Indeed. I thought with one unlink/insert it was singly. I was skim-reading though.
 
2:51 PM
@codemaker Ah lol I haven't seen the movie yet. Is it good?
 
now I wanna write a linked list class, just for the heck of it
@LewsTherin it is strange, but pretty funny.
 
@SSight3 Well, it is only for a special scenario, so it has a very small interface.
 
@LewsTherin They are packets, but TCP establishes stream with the other computer, UDP broadcasts irregardless of whether or not the other machine is receiving.
 
@LewsTherin TCP abstracts the packet stuff away.
 
@codemaker Excellent, I'm bored anyways
 
2:51 PM
With TCP you see a stream of data.
With UDP you see datagrams.
 
What does that mean? the data is sent like a river/stream? It sends one byte at a time?
i mean the data
 
there are a few other important differences between the two
 
@LewsTherin No, it sends it in packets.
But you see a stream.
 
@RMartinhoFernandes My list code in one line:
 
@LewsTherin It sends packets of bytes, but TCP ensures there isn't packet drops or other problems. UDP doesn't care.
 
2:53 PM
data List a = Cons a (List a) | Nil
 
what kind of bitfield defines itself as
struct fields
{
     uint32_t  bytesA    : 16;
     uint32_t  bytesB    : 17;
     uint32_t  bytesC    : (32-17);
}
what is 32-17? I can't seem to find a reference online...
 
@LewsTherin with UDP, each packet has a specific size. In TCP you just keep getting data, like you would from std::cin
 
Put it this way: UDP yells loudly into the ears of the other person regardless of whether or not they are deaf. TCP starts a conversation.
 
@FredOverflow But that lacks a lot of interface!
 
@RMartinhoFernandes of course, it was a joke :)
 
2:54 PM
(Though a quick Monad instance would automatically add a whole world to it.)
 
Ok so in tcp, the packets are of variable sizes, it will just assemble data into a packet as big or small as it sees fit. But UDP doesn't?
 
@LewsTherin also, TCP is connection oriented, where as UDP is not. That means before transporting TCP data, you make a connection from a client to a server. In UDP you can just start sending packets
 
@0A0D It's 15.
 
ah now I feel stupid :P
 
@LewsTherin No, you don't deal in packets unless you are implementing the protocol yourself.
 
2:55 PM
@LewsTherin there are no packets in TCP from the users perspective (on the actual network there are packets, but you don't have to care about those). When you read and write to a TCP connection, you just get data
 
@LewsTherin you say "I want to read 10 bytes", "ok now give me 3 more"
 
i thought it was some fancy syntax I have never seen before
 
@LewsTherin in UDP you say, "give me a packet, put it in this buffer that is X size", then it says, "ok, here is a packet I got, it is 25 bytes long"
 
@codemaker So in tcp, the data is encapsulated in packets, but we receive it as a stream?
 
2:56 PM
@LewsTherin right
 
When you read from std::cin how do you get the data?
 
@codemaker Does that mean we receive it one at a time?
 
It comes one buffer at a time, but you don't notice it.
You just get it as it comes.
 
So the difference between it and UDP is that it may not arrive in the right order, in a stream.
 
@LewsTherin that is another difference. TCP is reliable, the protocol has stuff built in so that packets that are lost get retransmitted and stuff goes in the right order
 
2:58 PM
UDP has no reliability and no traffic control.
 
Although you can implement reliability on top of it, like many games do.
 
0
Q: What language coined the term lvalue?

FredOverflowWas C the first programming language to use the term lvalue, or does it go further back? Note that I'm not talking about the general concept of "something on the left-hand side of an assignment statement" (which it has ceased to mean in C++ a long time ago). You can find that in pretty much any i...

 
@LewsTherin UDP is not reliable, if a packet get's lost you have no way to know. Protocols built on top of UDP that need reliability, implement their own ways to ensure delivery
 
@codemaker But that is the same thing as UDP. Packets get rearranged as they arrive. In TCP does it wait for the correct packet to arrive
 

« first day (377 days earlier)      last day (4579 days later) »