I'm running Windows 7 (64-bit).
This question looks at the same question found here:
but is more in-depth as it deals with even more data types and applies to C or C++, not C#. First of all, I am using Microsoft Visual Studio Ultimate 2012. Unfortunately, while this IDE supports C# and Visual C++ it no longer supports plain old Visual C it seems. Anyhow, I've tried the creating the following standard C++ program in the IDE:
#include <cstdio>
int main(int argc, char **argv) {
printf("sizeof(short): %d\n", (int) sizeof(short));
printf("sizeof(int): %d\n", (int) sizeof(int));
printf("sizeof(long): %d\n", (int) sizeof(long));
printf("sizeof(long long): %d\n", (int) sizeof(long long));
printf("sizeof(size_t): %d\n", (int) sizeof(size_t));
printf("sizeof(void *): %d\n", (int) sizeof(void *));
printf("Hit enter to exit.\n");
char *scannedText;
scanf("%s", &scannedText);
return 0;
}
and since I couldn't find the option to run a console application I simply placed a breakpoint at the "return 0;" statement, so as to view the output in the console. The result was:
sizeof(short): %d\n", 4
sizeof(int): %d\n", 4
sizeof(long): %d\n", 4
sizeof(long long): 8
sizeof(size_t): 4
sizeof(void *): 4
Hit enter to exit.
Old C textbooks state that int is set to the "word size", which is 16 on 16-bit machines and 32 on 32-bit machines. However this rule seems to break on 64-bit systems where one would expect the "word size" to be 64. Instead, from what I've read these systems are like 32-bit systems but have better support for 64-bit computations than their 32-bit counterparts did. Hence, the results obtained from the above C++ program are exactly the same as one would obtain on a 32-bit system. The size of data types (size_t) (which can be used to measure amount of memory taken up by objects in memory) also stores its values in 4 bytes, and it is also interesting that the size of pointers used to access memory locations (for instance sizeof(void *) shows the number of bits used to store generic pointers to any location in memory) is also 32 bits long.
Anyone know how come Visaul C was removed from Visual Studio 2012 and whether it is still possible to run console applications from Visual Studio 2012 without having to set a breakpoint or read text from standard input prior to exiting as above in order for the console window to pause before closing?
Furthermore, is my interpretation correct, or do I have something misconfigured in the IDE so that, for instance, it compiles for 32-bit rather than for 64-bit systems? According to one of the poster, since my system is 64-bit, I should see the results described here for size_t and pointers: https://en.wikipedia.org/wiki/64-bit_computing#64-bit_data_models but I am not seeing this. Is there a way to reconfigure Visual Studio so that it may support a 64-bit memory model, as opposed to what I am currently seeing in the program's output?
Thanks.