It is impossible. What happens when I write my operating system that has a weird C compiler?
That said, to be portable, you need to:
- Avoid Win32
- Avoid POSIX (which is annoying... You may want to just use Cygwin to provide Windows support)
- Avoid any platform specific library. This usually limits you in graphics to wxWindows, GTK, and QT.
- TEST. Make sure it works.
- Don't assume anything. Windows is weird and uses \r\n, so be careful about that.
- I think Visual C++ on windows gives you warnings about "unsafe c functions" and asks you to use the "safe ones", which are not standard. Don't fall for Microsoft's attempt to monopolize your program.
Some things will help:
- Autoconf will allow any decent system (ie one that includes a shell) to detect common portability issues and set up the correct headers
- Cmake can do this as well, but only on platforms that Cmake itself is available on