forcing compilation/run time linking of lib32 on amd64
Aryeh M. Friedman
aryeh.friedman at gmail.com
Wed Oct 24 19:01:07 PDT 2007
RW wrote:
> On Wed, 24 Oct 2007 16:49:24 -0400
> "Aryeh M. Friedman" <aryeh.friedman at gmail.com> wrote:
>
>
>> I am writing some demo code (for teaching C) ... showing that
>> int's are always word length
>>
>
> s/always/typically/
>
> C has been around for a long time and there is always a counter-example
> to any sweeping generalisation that isn't backed-up by a standards
> document.
BTW I was slightly wrong it is longs not int's that change depending on
word size:
Script started on Wed Oct 24 19:51:44 2007
> cat sizes.c
#include <stdio.h>
main()
{
printf("int:\t\t%d\n",sizeof(int));
printf("short:\t\t%d\n",sizeof(short));
printf("long:\t\t%d\n",sizeof(long));
printf("long long:\t%d\n",sizeof(long long));
printf("float:\t\t%d\n",sizeof(float));
printf("double:\t\t%d\n",sizeof(double));
printf("char:\t\t%d\n",sizeof(char));
printf("ptr:\t\t%d\n",sizeof(void *));
}
> gcc sizes.c
> ./a.out
int: 4
short: 2
long: 8
long long: 8
float: 4
double: 8
char: 1
ptr: 8
> gcc -m32 -B/usr/lib32 -L/usr/lib32 sizes.c # See "forcing
compilor/run time linking of lib32 on amd54" in freebsd-questions
> ./a.out
int: 4
short: 2
long: 4
long long: 8
float: 4
double: 8
char: 1
ptr: 4
Script done on Wed Oct 24 19:52:08 2007
More information about the freebsd-questions
mailing list