Overview of Portability Issues

The Visual C++ language is designed to be as platform-independent as possible. When portability issues arise, it is generally because the code makes erroneous assumptions about the underlying hardware.

C/C++ is a relatively low-level language. For example, given the address of an object on the stack, you can use pointers to attempt to access other objects you believe are also on the stack, just above or below the first object. Adopting such an approach is a typical cause of errors when porting code from x86 to Alpha because the Alpha calling conventions do not use the stack the same way that x86 calling conventions do.

Such conflicts are possible because the power and flexibility of C and C++ can sometimes be used to exploit implicit knowledge of how the underlying hardware operates. Unfortunately, such programming practices can cause problems that are difficult to debug when porting to other architectures. The following guidelines can help you in writing portable code: