Matt Godbolt: Hey, Ben.
Ben Rady: Hey Matt.
Matt Godbolt: We're going to have to come up with a better intro. It's just cliched now. We're actually a caricature of ourselves doing our own intro.
Ben Rady: We can't not do it. If we don't do it, then we're doing a bit. Whereas if we do it, we're just introducing the show.
Matt Godbolt: I suppose so.
Ben Rady: Right?
Matt Godbolt: I suppose so. Since I've started doing little cold intros as well, I've lost the bit where we introduce each other. Maybe we should mix it up a bit. Hello, friend.
Ben Rady: Hello.
Matt Godbolt: What are we talking about today?
Ben Rady: We're talking about remote work.
Matt Godbolt: Well, which is apt because on Fridays, that's exactly what we both do, which actually enables this very podcast.
Ben Rady: Although I did just have a tangent idea.
Matt Godbolt: Oh.
Ben Rady: Maybe we should do the tangent idea.
Matt Godbolt: All right, now let's do it. Tell me your tangent idea. Everyone, this is how planned these are.
Ben Rady: This is like a five-minute pretangent to the remote work episode.
Matt Godbolt: Go on then.
Ben Rady: How about that?
Matt Godbolt: Do it.
Ben Rady: Um.
Matt Godbolt: I believe that it's software engineer estimates time shocker.
Ben Rady: Yeah, oh boy. Two hours later, we're still talking about this.
Matt Godbolt: Yes.
Ben Rady: Um, I thought it could actually - this just popped in that I had just as I was starting up the show - we could do a 10 minutes on...
Matt Godbolt: Mm-hmm.
Ben Rady: Two on five minutes on...
Matt Godbolt: Now it's 10 minutes but already.
Ben Rady: Two's complement, the data storage mechanism, not the podcast like.
Matt Godbolt: Oh, you mean two's complement, how we store numbers.
Ben Rady: Yeah, yeah, right.
Matt Godbolt: Yeah.
Ben Rady: It's like when you're storing numbers in binary. You can use two's complement storage to do that and why would one do that, right?
Matt Godbolt: Well, why would one do anything but two's complement is more the point.
Ben Rady: Well, yes. So if you sit down and teach like a sixth grader binary, right?
Matt Godbolt: Mhmm.
Ben Rady: It becomes fairly easy to understand when you're just using normal integer counting numbers. You say, alright, well, this is the one's place, this is the two's place, this is the four's place. You add all these things up. Then you say, OK, so computers can only store so many bits. Maybe you've heard of an 8-bit computer, maybe you've heard of a 16-bit computer. They can only perform operations on so many bits. So you can see how it would be pretty easy to just store regular old integer numbers in this thing and have the computer operate on them.
Ben Rady: And then you might ask that sixth grader, well, OK, but what about negative numbers? And the first thing that they're probably going to say is, well, I guess you could use one of the bits to indicate whether the number is negative or not. And you say, OK, cool. Yeah, that works.
Matt Godbolt: It's a fairly obvious thing. It's how we do it in decimal, after all. We either draw a little minus in front or we don't. And that's kind of our one bit of sign. Yeah, it makes perfect sense. Well, what - yeah, what we're done here end of five minute.
Ben Rady: Yeah. End of five minute thing. And then you say, okay, well what happens? So that's true. And you can do that. But what happens when the sign portion of the bits is negative, but the value portion of the bits is zero?
Ben Rady: What does that mean?
Matt Godbolt: Right. Right. That's like, and again, in decimal, that's like writing minus zero, like the negative zero.
Ben Rady: Right.
Matt Godbolt: And you're like, well, I guess that's - I wouldn't write that down. Would you write that down? I wouldn't. So let's just not write it down.
Ben Rady: It's just a dumb thing.
Matt Godbolt: Right. Let's just not write it down. Let's just all agree that setting the sign bit to one and having all of the other bits to zero is just a dumb thing. Don't do that.
Ben Rady: But then you could see like - but okay, computers don't like it when we waste things. They don't like that. They want to try to use everything.
Matt Godbolt: Like one 256th of all the possible representable numbers in an 8-bit thing is just a "don't use me." I mean it could be a NaN or a null or empty. We could use it. I'm gonna continue to devil's advocate this for what it's worth.
Ben Rady: You could use it for something like that. But another way - yes, yes, yes. It's like, oh, we can do it and it will work. But there is a better way. And that better way is called two's complement.
Ben Rady: And in that world, we use that to just represent a completely different number.
Matt Godbolt: Mm hmm.
Ben Rady: I actually don't remember which side of the negative chain that is. Do you remember what it is?
Matt Godbolt: Well, you negate and add one is the kind of way that I internalize it, but yeah it closes the gap between zero and minus one in terms of the bit pattern representation.
Ben Rady: I'm going to have to Google it now so I can take a table.
Ben Rady: Mm-hmm.
Matt Godbolt: Which to me is the other thing that makes two's complement numbers really elegant. It is that most of the circuitry dealing with numbers doesn't need to know if it's signed or unsigned because it just works. It works the same way, whereas if you treat the sign bit separately, you now actually have to encode the rules about some of the things that can happen with negative and positive numbers. So it is a really clever trick.
Matt Godbolt: And you'll be hard pushed to find a computer that doesn't use two's complement to represent its numbers. But until very recently, the C and C++ standards required - not required. The C and C++ had made no assumptions about the representation of numbers. And so certain things were not defined, were left as undefined behavior. You couldn't rely on, for example...
Matt Godbolt: adding one to the highest possible number to get it to wrap around to negative, whatever, because, and you know, that's usually a good thing because like nobody really wants that to happen, right?
Ben Rady: Okay, yeah, right.
Matt Godbolt: If you add - but let's talk in fact about the two's complement aspects of this here. It's like, you know, we have this strange now lopsided number where the highest number we can represent with say eight bits, two's complement is 127, but the lowest is minus 128, which is kind of...
Ben Rady: Uh-huh, yeah.
Matt Godbolt: Displeasingly asymmetric. And that also means that you can't just unary negate any number and get another number because if I have minus 128 and I get the negative of it - like oh whoops, can't represent 128 anymore. So there are some weird edge cases. We've kind of pushed them around rather than at the zero point, they're now at the extents. And so it's kind of reasonable that if you added one to 127...
Ben Rady: Right, right, uh huh.
Ben Rady: Yeah. Yeah, yeah. Mm hmm.
Matt Godbolt: And you suddenly got minus 128, you probably didn't really mean to do that. You didn't want that to happen. And so it's left as undefined behavior. And so compilers can usually optimize around that. So look, you're not - we weren't expecting you to do this. Therefore, I'm not required to do it this way. For example, it may be that you use a bigger representation than an 8-bit value when you're using a signed 8-bit value. And that means that the carry rules don't work the same way. But it's also not supposed to happen. So the compiler might be able to use a 32-bit register instead of an 8-bit like shift and add and shift and add all the time, things like this.
Matt Godbolt: But very recently, they gave up on pretending that computers aren't two's complement, and they actually accept that like all practical computers these days are in fact two's complement.
Ben Rady: You.
Matt Godbolt: And I forget exactly the ramifications of this. Those who know me well know that I don't really participate much in the C++ standards stuff, but that one just came up on my radar. So I apologize for not having the, especially when you just dropped this on us at the beginning of this podcast. I haven't researched it in any meaningful way. And I have a very loud mechanical keyboard, so I can't even Google it while we're talking.
Ben Rady: Well, I also have a mechanical keyboard and nothing prevents me from doing that other than the clackety clacks that are the low pass filter.
Matt Godbolt: Oh short of me having to edit out the clacks in a minute. But no, what an awesome idea. We've named our podcast after a very neat trick.
Ben Rady: It is a neat trick. It's very elegant. And there's just something abhorrent to me as a programmer about having any sort of mechanism that just allows for nonsensical values by its structure, right?
Matt Godbolt: Yeah.
Ben Rady: Like if I can ever find something where those types of problems just aren't possible, that is always going to be a better solution. And this does that very well.
Matt Godbolt: Absolutely. Correct by construction is the sort of way that I've always internalized that. Although I will note that in the original Knuth book, The Art of Computer Programming or the various volumes...
Ben Rady: Yeah, yeah, that's the phrase people use.
Matt Godbolt: The MIX architecture - so Knuth is just such a legend for me for two reasons. One, he wrote like the book or the books on all algorithms which are like the most abstract things - like how to sort numbers all the hundreds of ways you can sort numbers very abstractly.
Ben Rady: Huh.
Ben Rady: Yeah, yeah, that's the phrase people use.
Matt Godbolt: But then he wrapped around on the - you know, talking of numbers that wrap around - he wraps around to the exact other side where he then implements them in assembly code in a computer that doesn't exist, that he made up so that he can demonstrate the purity of his algorithms using this invented machine, the MIX.
Ben Rady: Alright.
Matt Godbolt: Nowadays, there's a RISC-based one that has MMIX or something like that. But the one I remember growing up as a kid reading was the MIX one. And the amusing thing about that is - forgive me readers, listeners, whoever they are, if I get this a bit wrong - it is a sign bit based computer that is decimal.
Matt Godbolt: It stores numbers decimally with a sign bit.
Ben Rady: Hmm.
Matt Godbolt: So you do in fact have plus and minus zero. And then to your point about waste, Knuth goes as far as micro-optimizing his own made up instruction set for a computer that doesn't exist to implement algorithms that are like all about the big O notation and not about the constant factors, but he optimizes them anyway, because he's Knuth. And he starts using the sign bit to essentially encode a Boolean flag, because obviously these numbers, these values in here can also be pointers.
Matt Godbolt: And it doesn't make sense to have a negative pointer. So he just uses the decimal part as the pointer address. And then you could also for free get this one bit flag. And so some of his algorithms stuff things in that one extra bit. So it's not wasted in those instances, you know, a null pointer...
Matt Godbolt: With the bit clear is different from a null pointer with the bit set because it might mean null but red or null but black in a red-black tree.
Ben Rady: Oh, oh wow.
Matt Godbolt: Things like that. And just now you've just lit the litmus paper under me and I'm going now. A good friend of mine has just put together a proposal for the C++ committee about canonifying, reserving certain bits in pointers. Many things - you know, you have a pointer, it points to an address in memory, the things you point to have to be aligned at certain spaces.
Matt Godbolt: So you know, if you have a double precision number, that's an eight byte quantity on almost any hardware, you have to have it at an eight byte address. What that means is every pointer has wasted bits at the bottom, which always have to be zero because it has to be in a multiple of eight, right?
Ben Rady: Mm hmm.
Matt Godbolt: There's some - if you can just mask those bits out, you can access it as a pointer. But if you mask them in, then you've got some bits at the bottom, you've got two or three bits worth of like extra information.
Ben Rady: Mm hmm.
Matt Godbolt: And so she's put together a proposal which says like, can we canonify this because strictly by the book, you're not allowed to do those kinds of things.
Ben Rady: Mm hmm.
Matt Godbolt: Because once you start manipulating a pointer like it's an integer, the compiler can lose track internally that it points to a valid particular object and whatever. But she's made it so that that's okay.
Ben Rady: Hmm.
Matt Godbolt: So yeah, sometimes if you do have redundant representation, that's wasted bits, you can find another use for them.
Ben Rady: Well, someone will find a use for them because that's how that works.
Matt Godbolt: Someone will find a use. Whether that's good or bad, I don't know.
Ben Rady: Yes.
Matt Godbolt: But no, Hana uses it in a really smart way. In fact, we had her on the podcast.
Ben Rady: We did.
Matt Godbolt: So Hana Dusíková is behind that proposal and very smart it is too. And it's definitely something I'll be looking to use myself, you know, sneaking bits in.
Matt Godbolt: Anyway, that was not five minutes.
Ben Rady: No, it was not five minutes.
Matt Godbolt: But we can talk about remote work now.
Ben Rady: Now we can talk about remote work.
Matt Godbolt: So, needle scratch, tell me about how remote works works for you.
Ben Rady: Yep.
Ben Rady: Well, okay. The main thing for me is remote work is a trade-off between collaboration and productivity, essentially.
Ben Rady: I...
Matt Godbolt: Yes.
Ben Rady: Currently, I'm working with people who are either in California or New York, despite the fact that we have a Chicago office, and that is just pure happenstance.
Matt Godbolt: And that's where you are, for the avoidance of confusion.
Ben Rady: That is - yes, I am a Chicagoan. We are Chicagoans.
Matt Godbolt: If you can't pick it up from the accent.
Ben Rady: Chicago - what's the multi... I don't... anyway. So I commute into our Chicago office a few days a week mostly to see my friends.
Ben Rady: That's the main reason that I do it. Because, you know, the people that I work with are actually in California and New York, and I'm going to be talking to them over some sort of Slack or video call or something like that, no matter where I am.
Matt Godbolt: Right.
Ben Rady: So, you know, regardless of where I am actually physically, it's the same medium. But there is a lot to be said - and I know that people have made this complaint before, and this was obviously true for a lot of folks in COVID - but it's even still true for folks that sort of choose to have a fully remote... You know, they either work for companies that are fully remote or they have roles that are fully remote. Some amount of face to face interaction is, I think for most of the people that I've talked about this with, some amount of face to face interaction is really important because it's hard to develop those relationships when you are talking to everyone over...
Matt Godbolt: Mm.
Ben Rady: A video chat. And you can do it - unless people do do it - but it's...
Matt Godbolt: It was interesting. I was discussing with a friend the other day about how you can keep in touch with friends from home. I've moved 4,000 miles away from most of my friends from when I was growing up.
Matt Godbolt: And one way you can keep in touch with friends is playing video games where you can actually talk to people in real time. I was telling them in the pub the other day about the late nineties, where for whatever reason, I wasn't leaving the house very much. I was playing EverQuest.
Matt Godbolt: And I have now made real-life friends over what was purely a text-based thing.
Ben Rady: Huh.
Matt Godbolt: And to this day, I still talk to them. Yes, you can build a relationship using text medium, using face-to-face medium like this, but it's harder.
Matt Godbolt: And it only really happens well under either duress or when both sides really concentrate on it, where you both work at it to build that connection because unfortunately evolution is kind of against us. We have picked up on so many subtle cues about how humans interact.
Matt Godbolt: Being in a room with someone tells you a lot about how they are and you can learn about them so much more naturally. I'm searching for the right words here.
Ben Rady: Yeah, it's just a higher bandwidth interaction.
Ben Rady: I think the other thing about it is that when you're remote, there are very few accidental interactions.
Matt Godbolt: Yes, everything has to be really intentional. You have to schedule a coffee chat or whatever, rather than bump into someone as you're passing in the hallway to the bathroom.
Ben Rady: Yeah, how many times have you had an all-company meeting and you get there a couple minutes early and you just sit down next to a random person and you start talking to them?
Matt Godbolt: Yeah.
Ben Rady: Maybe you know them a little bit, and maybe you know them well. But that kind of interaction doesn't happen when everyone joins the all-company Google Meet. You're not chatting in the Meet in front of everybody else. Those sorts of accidental things can play a big part. But for the actual act of programming, writing code - I'm increasingly feeling different, and I think COVID was really the thing that tipped the scales for me because I was forced to create such a productive home setup that is so well optimized that there's no question to me that I'm a more productive programmer when I'm staying at home.
Matt Godbolt: I definitely agree with that, although I don't agree with having built myself a productive environment, because if you could see the camera right now, it is a catastrophe where I am. I meant to fix that today, and I did not.
Matt Godbolt: The main person in my life who pointed out how important it is to go into an office is in fact my wife, who obviously during COVID was forced to suffer full time with her husband. We have a great relationship, but I think all of us suffered from being in each other's pockets for a while.
Matt Godbolt: But she's like, "You need it. You need to go and see other people." And she was right.
Ben Rady: Mm-hmm.
Matt Godbolt: I like to pride myself on being rational, logical, not really driven by the more animalistic whims of our reptilian brain, but she's right. I absolutely needed it.
Matt Godbolt: And yeah, I agree. But in terms of focus time, obviously, we build our own focus time in the office with headphones or by trying to find a space away from the general thoroughfares to get some stuff done.
Matt Godbolt: But that's the default situation at home, dog barking notwithstanding. And the very lack of those interactions at home, the lack of the non-intentional interactions is actually the source of focus. I can get up and make a cup of tea and I'm still thinking about the problem that I'm working on while I'm waiting for the kettle to boil, whereas probably more healthily in an office, I'm talking to somebody who's also waiting for the coffee machine or whatever.
Matt Godbolt: And maybe that break is actually what I do need, but focus wise, it's true.
Ben Rady: Yeah, you definitely don't have the rubber duck effect when you're at home where, you know, you're working on some hard problem and you stand up in an equal mix of frustration and need for coffee or some other thing.
Matt Godbolt: Yeah.
Ben Rady: And then you run into somebody who will at least understand your problem and you wind up explaining it to them.
Matt Godbolt: Right, they'll understand the concepts even over the right.
Ben Rady: Right. Yes.
Ben Rady: Right.
Matt Godbolt: Oh, of course, that's the solution.
Ben Rady: Yep.
Matt Godbolt: Yeah.
Ben Rady: Yep. Yep.
Matt Godbolt: Yeah, and that's hard to recapture as you say, remotely.
Ben Rady: Mm-hmm.
Matt Godbolt: I mean, if you've got, as you well know, I'm very well versed at just puking out my thought process into Slack into a long thread of things in the hope that sometimes brings people along for the ride in terms of what I'm thinking or gives them people come in and say, "Why are you doing that?"
Ben Rady: Huh.
Matt Godbolt: But again, it requires intentionality.
Ben Rady: Yeah. And so the plot twist of this whole thing, I think, is that you can make the argument.
Ben Rady: And I enjoy remote work and I do feel very productive when I do it. And I do it because I'm productive. But you can make the argument that productivity, in its very purest sense for programmers, is bad.
Matt Godbolt: Oh, this is.
Ben Rady: And the reason I say that is because I have had many times in my life, and I think that this is more common when I'm remote, when I'm working by myself, when I've got my headphones on or whatever, and I'm just in the zone and I'm programming, where you are creating code. And as we've talked about before, code is a liability.
Ben Rady: Code is not good. We're trying to solve problems, not make a bunch of code that we need to maintain and test and deploy and debug and all the other things.
Ben Rady: And there are many times when the right thing to do is not just puke out a bunch of code as efficiently and productively as you can, but to take a step back and to maybe talk to a few coworkers and be like, do I even need to be solving this problem at all?
Matt Godbolt: That my friend is absolutely spot on. I mean, yeah, so in the throws of COVID, there is at least one reasonably large chunky piece of code that I'm very proud of and is used. But ultimately is now being phased out because really was overcomplicated.
Matt Godbolt: Could be replaced with something a bit more straightforward, was part of a grander vision that didn't come to being. And ultimately, yeah, perhaps should have never been written.
Ben Rady: Mm-hmm.
Matt Godbolt: And it served the purpose. It kept me amused for a few months while I was sat rocking slowly backwards and forwards in this very chair. But, no, that's a really interesting observation that, unfortunately though, as programmers, we love that state and we love doing that.
Ben Rady: We do.
Matt Godbolt: And we love that thing as we've discussed before, the whole flow and all that good stuff.
Ben Rady: Yes. Right.
Ben Rady: Right. Yes. Do you really need this fancy thing? And I mean, a lot of the time that is a very productive and good state to be in, but it is not strictly true.
Ben Rady: That it is always good at the exclusion of interacting with other people, double checking your ideas, making sure that you're doing things that actually need to be done and making sure that you're doing them in a reasonable way and not just going all full mad scientist.
Matt Godbolt: Right, or "10x developer", and then you've got 10x as much code that no one else understands or has seen and doesn't even need and you're like, as you say, it's a liability. Now, that's a really interesting observation.
Matt Godbolt: Well, that seems like what a two-tone kind of a podcast we've recorded today.
Ben Rady: We could split this in half and do it in two parts if it wasn't like 30 minutes long.
Matt Godbolt: I don't know that I'm that skilled enough an editor for that. So I'm afraid everyone's just going to end up with it pretty much raw.
Ben Rady: Yeah. This is going to be the peanut butter and pickle sandwich of Two's Complement podcasts.
Matt Godbolt: Hmm. That doesn't sound too bad though.
Ben Rady: It's disgusting. I don't know why anyone would eat that, but we're just going to take two things.
Ben Rady: Actually, you know what this is like? Did you ever see the movie From Dusk Till Dawn?
Matt Godbolt: That's the vampire one, right?
Ben Rady: Well, the second half is vampires. The first half is a bank heist movie.
Matt Godbolt: Oh yeah, that's, oh yeah. I just remember it as vampires, but yeah, now you say that. I'm like, oh yeah, it's like a cut and shut.
Ben Rady: Actually, I'm not sure I do know what that means.
Matt Godbolt: That's when you've had two cars that have been involved in an accident and they're cut in half and the good halves of them welded together to make one good car out of the two. No, is that not a thing?
Ben Rady: I've never heard that.
Matt Godbolt: Like you can imagine like two Ford Focuses have been, one's been smashed in the front, one's been smashed in the back.
Matt Godbolt: So you just cut them in half and stick them together and you sell it as a good car.
Ben Rady: Okay.
Matt Godbolt: Only the British could be so unscrupulous as to do something like that. It surprises me, but whatever.
Ben Rady: Yeah, yeah, yeah. The first half of this podcast was a bank heist and the second half we talked about remote work.
Matt Godbolt: Well, to that effect, I think we're pretty much done for this episode. And so I will speak to you on the next one.
Ben Rady: Yep, next time.