On Sat, 18 Oct 2014 19:51:53 -0700 (PDT), JCW <
please....@comcast.net>
wrote:
>On Saturday, October 18, 2014 8:40:45 PM UTC-4, Geoff wrote:
>
>> >2) I assume, however, that the executables produced will only run
>> >on the corresponding computer architectures (e.g., executables
>> >produced by LCC-Win32 will **not** run on a 64-bit processor).
>> >Correct?
>>
>>
>> Incorrect. Executables produced by LCC-Win32 will run on any 32 or 64
>> bit Windows system. Note, I say Windows system and not processor,
>> since LCC targets Intel Windows and not generic processors. (e.g.,
>> Surface RT)
>>
>
>Geoff -- Thanks for the info.
>
>The above-quoted response, however, I don't completely understand.
>Are you saying that a 32-bit EXE file (written for command-line
>execution, not for the Windows GUI, which is completely over my
>head) will run on a 64-bit Windows 7 system (with a 64-bit Intel
>processor)? If so, maybe my existing code (compiled in LCC-Win32)
>will also run?
>
I see no reason why it won't run. A 64 bit Windows 7 system will execute 32-bit
code just as any 32 bit Windows 7 system will. The only caveat is that your
program can't depend on privileges that weren't locked down in Windows XP or
predecessors but that isn't a constraint due to the bit width of the system.
>A finer point that I had trouble with moving from 16-bit to
>32-bit "ANSI" C (a la Kernighan and Ritchie):
>Do the definitions of data types like "short" and "long"
>integers change between the 32- and 64-bit versions? -- JCW
No, short and long remain the same size between 32 and 64 bit platforms.
Pointers will definitely change but your existing application won't be able to
take advantage of that until you recompile it for x64.
Here's some code to use to test the sizes of the standard integer types.
#include <stdint.h>
#include <limits.h>
#include <stdio.h>
//test limits macros
int main (int argc, const char * argv[])
{
uintptr_t up;
up = -1;
printf(" CHAR_BIT = %2i MB_LEN_MAX = %2i\n\n", CHAR_BIT, MB_LEN_MAX);
printf(" CHAR_MAX = %10i CHAR_MIN = %10i\n", CHAR_MAX, CHAR_MIN);
printf(" SCHAR_MAX = %10i SCHAR_MIN = %10i\n", SCHAR_MAX, SCHAR_MIN);
printf(" UCHAR_MAX = %10u\n\n", UCHAR_MAX);
printf(" SHRT_MAX = %10i SHRT_MIN = %10i\n", SHRT_MAX, SHRT_MIN);
printf(" USHRT_MAX = %10u\n\n", USHRT_MAX);
printf(" INT_MAX = %10i INT_MIN = %10i\n", INT_MAX, INT_MIN);
printf(" UINT_MAX = %10u\n\n", UINT_MAX);
#ifndef __i386
printf(" LONG_MAX = %20li LONG_MIN = %20li\n", LONG_MAX, LONG_MIN);
printf(" ULONG_MAX = %20lu\n\n", ULONG_MAX);
#else
printf(" LONG_MAX = %10li LONG_MIN = %10li\n", LONG_MAX, LONG_MIN);
printf(" ULONG_MAX = %10lu\n\n", ULONG_MAX);
#endif
printf(" LLONG_MAX = %20lli LLONG_MIN = %20lli\n", LLONG_MAX, LLONG_MIN);
printf("ULLONG_MAX = %20llu\n", ULLONG_MAX);
printf("UINTPTR_MAX = %20llu\n\n", UINTPTR_MAX);
#if CHAR_BIT < 8 || CHAR_MAX < 127 || 0 < CHAR_MIN \
|| CHAR_MAX != SCHAR_MAX && CHAR_MAX != UCHAR_MAX
#error bad char properties
#endif
#if INT_MAX < 32767 || -32767 < INT_MIN || INT_MAX < SHRT_MAX
#error bad int properties
#endif
#if LONG_MAX <
2147483647 || -
2147483647 < LONG_MIN || LONG_MAX < INT_MAX
#error bad long properties
#endif
#if LLONG_MAX < 9223372036854775807 || -9223372036854775807 < LLONG_MIN ||
LLONG_MAX < LONG_MAX
#error bad long long properties
#endif
#if MB_LEN_MAX < 1
#error bad MB_LEN_MAX
#endif
#if SCHAR_MAX < 127 || -127 < SCHAR_MIN
#error bad signed char properties
#endif
#if SHRT_MAX < 32767 || -32767 < SHRT_MIN || SHRT_MAX < SCHAR_MAX
#error bad short properties
#endif
#if UCHAR_MAX < 255 || UCHAR_MAX / 2 < SCHAR_MAX
#error bad unsigned char properties
#endif
#if UINT_MAX < 65535 || UINT_MAX / 2 < INT_MAX || UINT_MAX < USHRT_MAX
#error bad unsigned int properties
#endif
#if ULONG_MAX < 4294967295 || ULONG_MAX / 2 < LONG_MAX || ULONG_MAX < UINT_MAX
#error bad unsigned long properties
#endif
#if ULLONG_MAX < 18446744073709551615U || ULLONG_MAX / 2 < LLONG_MAX ||
ULLONG_MAX < ULONG_MAX
#error bad unsigned long long properties
#endif
#if USHRT_MAX < 65535 || USHRT_MAX / 2 < SHRT_MAX || USHRT_MAX < UCHAR_MAX
#error bad unsigned short properties
#endif
printf("sizeof int* = %i\n", sizeof(unsigned int*));
printf("sizeof size_t is %i\n", sizeof(size_t));
printf("sizeof uintptr_t is %i\n", sizeof(uintptr_t));
printf("uinptr_t can contain %20llu\n\n", up);
puts("SUCCESS testing <limits.h>");
return 0;
}