sizeof operator machine dependent?
The sizeof operator
isn't, in itself, machine dependent (or rather, as Peter87 says, implementation dependent.) But the size of an int, is.
And Turbo C++ is a 16-bit compiler, so it works with 16-bit ints. So when you ask it how big an int is, it says 2 bytes (i.e. 16 bits).
Turbo C++ is, as you say, an old, old compiler (orig. release was 1990); it was aimed at (16-bit) DOS and the old Windows (e.g. Windows 3.1) 16-bit O/S.
When you run an app you compiled with Turbo C++ on a modern Windows system, you're not actually running it directly on the system. Instead it's been run by WOW (Windows on Windows), the 16-bit compatibility layer.
Code::Blocks, on the other hand, usually works (on Windows) with the MinGW version of GCC, which can be either the 32-bit or 64-bit version of the compiler. Both use 32-bit ints. (A 64-bit compiler could work with 64-bit ints, but this isn't usually done.)
- int is 16-bit (same as a short), long is 32-bit, near
pointers are 16-bit, and far
pointers are 32-bit (the FAR macro means something when you're compiling for 16-bit systems.)
- int, long and pointers are all 32-bit.
- for 64-bit Linux : long and pointers are 64-bit but int is 32-bit.
- for 64-bit Windows : long long
and pointers are 64-bit but long and int are both 32-bit.
- it is, of course, possible for int, long, and pointers to all be 64-bit. For more info, see:
The MinGW version of GCC follows the Windows convention, not the Linux one, so the binaries it creates are compatble with Windows (e.g. calling the Win32 API.)
Windows on Windows