Blogs / Personal blogs

Evan Klitzke

eklitzke.org

Popular posts
9
Total points
1,907
HN comments
1,965
Rank
#889 personal

Visit eklitzke.org → On Hacker News Nov 2016 – Oct 2022

Software Engineering 6Tools & Productivity 4Systems & Performance 4Security & Privacy 1Math & Algorithms 1Programming Languages 1

1

Bash $* and $@ (2017)

In Bash, there are two closely related "special parameters" for accessing how the current script was invoked: $* and $@ . For both variables, the behavior is affected by whether or not the variable is enclosed in double quotes. The following table summarizes all cases:

2

How Tail Call Optimization Works

Most undergraduate computer sciences courses teach students about tail call optimization (TCO) , and even if you don't have a formal computer science background the concept is talked about enough that you might be familiar with it anyway, especially if you've ever done any functional programming. However, I think the…

3

In Defense of C++

I really like C++. It's not the right tool for every job, but it's what I reach for when I need to do any kind of systems programming. Unfortunately, C++ has often been cited as a "bad" language, and I feel like that reputation has worsened over time. Recent languages like Go and Rust have taken over a lot of mind…

4

Goroutines, Nonblocking I/O, and Memory Usage

I am generally a fan of Go's approach to concurrency: writing code with goroutines is a lot easier than writing traditional nonblocking network servers in a language like C or C++. However, while working on a highly concurrent network proxy I came across an interesting realization about how the Go concurrency model…

5

Beware of strncpy and strncat

Most C programmers also know to avoid the legacy strcpy() and strcat() functions, as these commonly introduce buffer-overflow problems. Instead, C programmers should use the newer strncpy() and strncat() functions, which check the size of the buffer they're copying data into.

6

X86 Register Encoding

If you've ever look at the disassembly output for C or C++ code, you'll probably notice that there are a lot of push/pop instructions. And if you pay close enough attention, you'll notice that the compiler prefers to use certain registers over others. In particular, compilers will prefer pushing "old" registers like…