- Size of Data Types
- Always use sizeof() to get the size of types(sizeof(char), sizeof(short), sizeof(int)...)
- Do not depend on the order of evaluation in an expression
- Char type may be singed or unsigned. Better to use an integer to store the output of getchar().
- Use standard Libraries
- Write platform-specific code is possible.
Reference from http://www.cs.princeton.edu/courses/archive/spring06/cos217/lectures/24portable.pdf
Writing Portable Programs,布布扣,bubuko.com
时间: 2024-11-08 13:02:34