When I say "portable code" I am referring to source portability. Ultimately, the code is turned into machine language for a specific microprocessor type. That code will not run on another microprocessor unless that microprocessor is solidly compatible with the original type. That is a very, very rare circumstance.

Source portability means that you can take your source code to another machine and compile it there. The new, correct machine code will then be emitted.

Even when machines have the same microprocessor, the code may not be portable. There are implementation-specific ways to talk to the hardware. One keyboard is not like another. One display is not like another. This is why our machines have very specific drivers. If your compiler does not have access to the means of correctly addressing these drivers, the code will not be portable.

Languages are not built to address specific sets of hardware and OSes. They are built to solve common problems. They address SPECIFIC issues only because the language writers have written NONSTANDARD libraries which deal with all that.

Bottom line: take "explorer.exe" from a Windows machine and try to run it on a Mac. At best, it just won't work. At worst, it may turn the machine into a molten slag heap. Don't bill me for the damage: you have been warned.