Writing Portable Programs

  1. Size of Data Types

    1. Always use sizeof() to get the size of types(sizeof(char), sizeof(short), sizeof(int)...)
  2. Do not depend on the order of evaluation in an expression
  3. Char type may be singed or unsigned. Better to use an integer to store the output of getchar().
  4. Use standard Libraries
  5. 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

Writing Portable Programs的相关文章

Using assembly writing algorithm programs

This's my first version.The logic is simple, just the selection sort. I spent much time learning how to write AT&T assembly on 64-bit Linux.almost all books just talk about 32-bit assembly. Such as registers, on 64-bit linux, rax, rbx, rcx..... are a

转载:Why Developers Should Not Write Programs That Call 'sun' Packages

The java.*, javax.* and org.* packages documented in the Java Platform Standard Edition API Specification make up the official, supported, public interface. If a Java program directly calls only API in these packages, it will operate on all Java-comp

Writing Reentrant and Thread-Safe Code(译:编写可重入和线程安全的代码)

Writing Reentrant and Thread-Safe Code 编写可重入和线程安全的代码 (http://www.ualberta.ca/dept/chemeng/AIX-43/share/man/info/C/a_doc_lib/aixprggd/genprogc/writing_reentrant_thread_safe_code.htm) In single-threaded processes there is only one flow of control. The

Python Geospatial Development reading note(1)

chapter 1, Summary: In this chapter, we briefly introduced the Python programming language and the main concepts behind geospatial development. We have seen: ~That Python is a very high-level language eminently suited to the task of geospatial develo

OpenGL

https://www.opengl.org/resources/libraries/glut/glut_downloads.phpAbout GLUT . . .GLUT (pronounced like the glut in gluttony) is the OpenGL Utility Toolkit, a window system independent toolkit for writing OpenGL programs. It implements a simple windo

oepn sync

http://blog.csdn.net/cywosp/article/details/8767327 SYNOPSIS #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> int open(const char *pathname, int flags); int open(const char *pathname, int flags, mode_t mode); int creat(con

Qt5.4 All Modules

Qt5.4 All Modules Qt Essentials Qt essentials define the foundation of Qt on all platforms. They are available on all supported development platforms and on the tested target platforms. They will remain source and binary compatible during Qt 5. Essen

OpenMP初步(英文)

Beginning OpenMP OpenMP provides a straight-forward interface to write software that can use multiple cores of a computer. Using OpenMP you can write code that uses all of the cores in a multicore computer, and that will run faster as more cores beco

[Maven]package com.sun.image.codec.jpeg does not exist

----------------------------------------------------------------- 原创博文,如需转载请注明出处! 博主:疲惫的豆豆 链接:http://www.cnblogs.com/dzblog/p/6971245.html ---------------------------------------------------------------- 环境 Maven:3.0.5 Java:1.8.0_45 OS:Linux 问题 拿到一个j