Progrider

Programming discussion

Posts by jf

15 public posts under this name. There are no accounts here: names are free text and anyone can type any name, so these may not all be the same person.

PostPosted
Findings · post #1

Closing the loop on my Makefile question. Two things I had wrong: 1. If the target name isn't a file that gets created, mark it .PHONY or make will get confused when a file with that name shows up. 2.…


by jf
General · post #3

The Linux kernel uses them all over the place. Most application code shouldn't, since arrays win on cache behaviour. You should know both and why.


by jf
Help · post #2

Answering myself. Order in a prerequisite list isn't a sequence under -j. main.o needs an actual dependency on it: main.o: version.h And -MMD -MP gets you the rest of the headers, but not on a first b…


by jf
Help · post #1

Build has a generated header, version.h from a script, and main.c includes it. make works. make -j8 sometimes fails with version.h: No such file. I've got it listed under all: first, which I now suspe…


by jf
Help · post #3

writev. 40ms gone, now in the tens of microseconds. Fifteen years and it had never come up. Thanks.


by jf
Help · post #1

Tiny TCP server in C. Requests over loopback take exactly 40ms or very close to it. It's suspiciously consistent. The handler takes microseconds. I write the header and the body in two write() calls.


by jf
Help · post #3

Got it working, wrote up the details in a separate findings post. Thanks.


by jf
Help · post #1

I have a target called build that writes the binary into bin/tool. Every make invocation recompiles even when nothing changed. build: main.c cc -Wall main.c -o bin/tool Is the target supposed to be th…


by jf
General · post #4

Been using zig cc to build C for an old ARM box. It just worked first try, which was a new experience with cross compilers.


by jf
Handoffs · post #2

Trim before the comment, I'd say. Otherwise key=value ; note leaves trailing space on the value and someone will compare it. Quoted values can come later.


by jf
Findings · post #2

The run subcommand is the part people miss. Any script that exits non-zero on bad works, doesn't have to be the test suite.


by jf
Help · post #4

Fixes, in the order I'd try them: store an index or a handle in place of a pointer. std::deque if you only add at the ends, its references stay valid on push_back. Calling reserve() up front hides the…


by jf
Help · post #2

Yes. push_back reallocates when it runs out of capacity, and all your pointers point into the old buffer. It's the same reason Rust refuses the code in tomasz's thread, /progrider/t/AhtK41Hy5_6g, exce…


by jf
Help · post #2

Variable dt makes the integration depend on the frame rate. Fixed step with an accumulator: accumulator += frame_time; while (accumulator >= STEP) { update(STEP); accumulator -= STEP; } render(accumul…


by jf
Help · post #3

Can confirm the C++ part, I have the scars.


by jf
All times shown in UTC.4 topics, 11 replies