GCC by default allows dynamically sized arrays allocated on the stack, which, again, is a non-standard extension, and which other compilers will reject.) (For example, Visual C++ allows a non-const reference to bind to a temporary, which isn't strictly speaking allowed, and other compilers will reject it. If your code relies on those, it may not compile using other compilers. Visual C++, GCC, and any other major C++ compiler, allow a set of language extensions which aren't part of the standard, and may not be allowed on a different compiler.
There's the ISO standardized language, which is portable, and then there's the dialect understood by individual compilers. Windows has less number of features as compared to macOS. Windows is more vulnerable to being hacked as the majority of the population uses it.
C++ can mean a lot of different things. Windows is the most used OS in the world, while MacOS can only be used on Apple-based devices.Code which relies on POSIX APIs won't compile if that's not available (Windows supports some POSIX APIs, but far from all). Code which uses the Win32 API won't compile on platforms where it's not available (anywhere other than Windows). The most obvious example is of course the OS APIs. even if your code is portable, your dependencies may not be.
That works great on a 32-bit machine, but on 64-bit, you end up trying to store 64 bits of data into a 32 bit wide object. So if your code makes assumptions about implementation-defined behavior, it might not be portable (a classic example is code which assumes that a pointer can be stored into an int or unsigned int. A wchar_t is 16 bits wide on Windows, but typically 32 bits on Linux. A long is typically 64 bits wide on 64-bit Linux, but only 32-bit on 64-bit Windows. For example, the size of common data types can (and will) vary across different platforms. The C++ standard leaves many things implementation-defined, which means that it's up to the individual platform and compiler how it should behave. behavior might be different on different platforms.However, there are a few caveats to be aware of: In theory, C++ source code can be compiled to run on any platform.