[prev] [index] [next]

C and Portability

Some specific portability issues with C programs ...
  • size of data types are not guaranteed any more than

    sizeof(char)  sizeof(short)  sizeof(int)
     sizeof(long) sizeof(float)  sizeof(double)
    

  • evaluation order is not completely specified by the standard, e.g.

    twochars = (getchar() < 8) | getchar();
    ptr[count] = name[++count];
    printf("%c %c", getchar(), getchar());
    ... however ...
    word[n++] = ch;  //ok
    *cp++ = ch;      //ok