Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
gandalf013
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
5 ms
·
1.
▲
by
gandalf013
5y ago
India's population is approximately 4.5 times that of USA, so the actual ratio is "one American is emitting 35 Indians worth of carbon emissions".
2.
▲
by
gandalf013
6y ago
bc calculator doesn't (or didn't) define pi, but has atan. I've used "4*atan(1) method" in bc to get pi.
3.
▲
by
gandalf013
6y ago
Hobbes: Do you have an idea for your project yet? Calvin: No, I'm waiting for inspiration. You can't turn on creativity like a faucet. You have to be in the right mood. Hobbes: What mood is that? Calvin: Last-minute panic.
4.
▲
by
gandalf013
9y ago
A very common idiom is "T p = malloc(n sizeof *p)". That only works if sizeof doesn't evaluate its arguments.
5.
▲
by
gandalf013
12y ago
http://benpfaff.org/writings/clc/strncpy.html
6.
▲
by
gandalf013
13y ago
The standard actually specifies (or specified?) that the flexible array member must come after all the members, including the padding. But, from my reading, that wasn't their intent, and is certainly not how compilers implement it. T
7.
▲
by
gandalf013
13y ago
A more correct version might be: #include <stddef.h> int buf_offset = (int)offsetof(struct sdshdr, buf); struct sdshdr *sh = s - buf_offset; This is because the compiler might insert padding between your struct eleme