15.1 Rusty Scale for API Design
Keywords: perfbook_html

#
15.1 Rusty Scale for API Design

1. It is impossible to get wrong. dwim()
2. The compiler or linker won't let you get it wrong.
3. The compiler or linker will warn you if you get it wrong.
4. The simplest use is the correct one.
5. The name tells you how to use it.
6. Do it right or it will always break at runtime.
7. Follow common convention and you will get it right. malloc()
8. Read the documentation and you will get it right.
9. Read the implementation and you will get it right.
10. Read the right mailing-list archive and you will get it right.
11. Read the right mailing-list archive and you will get it wrong.
12. Read the implementation and you will get it wrong. The non-CONFIG_PREEMPT implementation of rcu_read_lock().
13. Read the documentation and you will get it wrong. DEC Alpha wmb instruction.
14. Follow common convention and you will get it wrong. printf() (failing to check for error return).
15. Do it right and it will break at runtime.
16. The name tells you how not to use it.
17. The obvious use is wrong. smp_mb().
18. The compiler or linker will warn you if you get it right.
19. The compiler or linker won't let you get it right.
20. It is impossible to get right. gets().