Does anyone have any useful mnemonics for remembering the order of function parameters or the return values of Unix system calls? I am suffering from "memory leaks".
Most common syscalls - read(2) and write(2) takes 3 parameters: descriptor, buffer and length. Returns number of bytes actually read or written. close(2), obviously, takes one parameter - descriptor to close.
Most syscalls return -1 in case of error and sets
Everything else I usually read in corresponding man page. Just don't forget the command:
P.S.: do you have intro(2) ?
This is a common problem for most developers. If you write code often you will eventually find some patterns that you can use as mnemonics, for example file descriptors are usually the first parameter. But there will always be annoying exceptions hard to memorize.
You are approaching the problem the wrong way. There is a good reason why so many sophisticated development tools exist. Instead of making your life harder, start using a specialized source code editor or an integrated development environment.
Some of the standard features (Auto-completion lists, realtime syntax checking, documentation tooltips) will eliminate your problem, taking away a big overhead for you. After all, that's what computers are for, doing the boring repetitive tasks, so you can focus on the interesting stuff.