davidwf
Joined 11 years ago
Joined 11 years ago
I worked through this and felt well-prepared to actually use C in anger when I had to.
Let's say you need to dynamically allocate two buffers in a function and want to make sure they are freed at the end of your call. You can use this macro like so:
int two_bufs(int n, int m) {
int *buf_1 = NULL;
int *buf_2 = NULL;
buf_1 = calloc(n, sizeof(int));
CHECK(buf_1);
buf_2 = calloc(m, sizeof(int));
CHECK(buf_2);
// ... lots of cool things with buf_1 and buf_2
error:
free(buf_1);
free(buf_2); // Safe if null
}[1] https://github.com/ThrowTheSwitch/Ceedling/tree/master/plugi...
Elitist assholes definitely exist everywhere, but in my experience a lot of what I viewed as "showing off" when I was younger was really just "being normal" for a different "normal". When a 25-year-old software developer talks all the time about Stanford and Lambos, he's not trying to show off, he's just talking about what he knows, just like the guy talking about tail-gating at <insert SEC school here> and then going four-wheeling all the time.
I don't want to devalue experience and education in any way; those things have value! But time is linear and the past has happened -- you just have to move forward with what you have and go after what you want, and don't get distracted by the fact that others started out with a lot more than you. I double-pinky-promise you that if you are good at something, keep getting better at it, and aren't an asshole yourself, you can work at any company you want. :-)
I'm not saying that this is literally correct -- the brain is way more complicated than that! But I find it quite useful as a metaphor for processing and understanding social dynamics that I inherently find "irrational".
I found the first half of "Prometheus Rising" by Robert Anton Wilson to be incredibly useful for understanding human dynamics -- I use the framework presented there every day. The core of this is in my opinion just a very straightforward computer-focused analogy that gives me insight into the behaviour of other people and myself that I haven't found elsewhere.
Of course, outside the core is a LOT of wild new age, Crowley-Leary-Regardie syncretism that provokes strong negative throw-the-book-across-the-room reactions in most people. A lot of very reasonable people would look at the wikipedia page or the cover of this book and not only think that the book is crap, but also that I'm a crazy hippie for even considering reading it.
I think it's important to keep in mind "signal bias" -- I'm never on other social media, and I'm only on HN every weekday over my breakfast and morning coffee. I don't spend time building my brand or writing blog posts or shouting from the rooftops about how great my life is because I'm trying hard to stay busy actually enjoying how great my life is. In my experience, there really are a lot of folks who've made similar decisions, it's just that part of managing your life is also giving up on trying to convince strangers that you're awesome.
The specific reason for the size disparity is that we require he_conn->{username,password} to be null-terminated, whereas we do NOT require he_msg_auth->{username,password} to be null-terminated. I remember raising the same point and being convinced that we had a good reason for doing so, but I also haven't had enough coffee to remember what the good reason was!
Regardless of whether this is a "bug" or not I do think that the disparity points to something that unnecessarily causes confusion, will have a think about making it more consistent.
Regarding style -- I also ~hate if(x==0) without the space after the if but we committed to consistency instead of arguing over it via clang-format. To quote Rob Pike, "Gofmt's style is no one's favorite, yet gofmt is everyone's favorite."
Overall, I would say that there's larger gaps between companies than there are internally to countries. Especially in India, I was consulting and definitely spent time on an Infosys campus in Bangalore where they had unscrewed half of the overhead lights to save money, but I also worked with some places that felt more or less like any other high-tech company anywhere else in the world.
Similarly, when I was looking for work here in Singapore, there were definitely folks that were looking to hire folks with 15 years of experience and pay them $80k/year, but there were also several companies that offered high-paying jobs with interesting work. There were definitely FEWER companies, but the flip side is that the hit rate was much higher -- I ended up getting at least a first interview with 70% of the companies I sent my resume to here, as opposed to the 20-25% I generally find in the US. In general, companies are very keen to hire "American" tech talent, especially if you have a "name-brand" on your resume.
In terms of compensation, if you are relocating, you really do have to look at the holistic quality-of-life. I ostensibly took a "paycut" in US$ terms from my Google NYC job for my role here in Singapore, but I also went from a tiny 2 bedroom apartment and a 45 minute subway ride to a 3 bedroom walking distance to work with a full-time nanny who works 6 days a week, cleans, and cooks in addition to watching our two kids.
Living "overseas" has been a great joy in my life -- I may end up back in America for some time but I also see myself living elsewhere for as much or more time. I can't recommend it enough -- the world is a pretty incredible place!
https://freakonomics.com/podcast/book-club-hastings/
Highly recommend the podcast!