- Identifiers should not have vowels; they are expensive and difficult to type.
- An identifier must not be longer than 8 characters. The only exception are functions intended for standardization like sched_ss_init_budget.
- Functions must not be reentrant. Relying on internal state means you can avoid allocating memory.
- Functions should take at least two parameters. The second parameter should be a "flags" parameter which causes the function to do entirely different things.
- Flags should be passed as macros with unspecified values. These macros must not have reasonable values.
- Error handling must be done in one of two ways. The choice must not be consistent with other functions in the library:
- The real return value should be stored in an "out" parameter. The return value must only determine if an error has occurred or not.
- If an error occurs, the return value must be undefined. The return value can't be safely used without checking for errors using a separate function (e.g., fgets).
- The error code should be in errno, requiring the setting of `errno = 0` beforehand and checking after an error occurs. However, the return value should be a value legally allowed to be in errno, so that initial attempts to use the function appear to work.
- If the function returns a string, it must do so by modifying a memory location given as a parameter. Whether or not the string is terminated with a null must be determined solely based on the length of the output, a user supplied parameter, and choice of compiler.
Showing posts with label Misc. Show all posts
Showing posts with label Misc. Show all posts
Saturday, February 17, 2018
Some rules for designing libc style APIs
Monday, March 1, 2010
Prediction: yahoo won't matter
Within the next 5 years Yahoo!, like AOL will still be around but won't matter at all.
Saturday, February 13, 2010
Thursday, February 4, 2010
The Daily Monthly
From the author of Cognitive Daily we have the The Daily Monthly. Each month a new topic but each day a new post (http://dailymonthly.com/)
Sunday, January 24, 2010
Cognitive Daily comes to a close
Cognitive Daily, one of the best physcology blogs around, announced they will no longer be posting anything new.
I've been reading Cognitive Daily since I was in high school and I'm very saddened to see it go.
I've been reading Cognitive Daily since I was in high school and I'm very saddened to see it go.
Subscribe to:
Posts (Atom)