EST (えじょねこさん時間)の近づきを観測
こうかな?
$ cat ganyo.c
int main(void)
{
int a = 0;
return *((int *)a);
}
$ gcc -Wall ganyo.c
ganyo.c: In function ‘main’:
ganyo.c:4:12: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
4 | return *((int *)a);
| ^
longと同じ幅っぽい
$ cat ganyo.c
int main(void)
{
long a = 0;
return *((int *)a);
}
$ gcc -Wall ganyo.c
(警告なし)
$ ./a.out
Segmentation fault (core dumped)
ナウでヤングなOSわからない
$ ulimit -c unlimited
$ ./a.out
Segmentation fault (core dumped)
$ ls *core*
ls: cannot access '*core*': No such file or directory
@ganyo ですねー
$ cat ganyo.c
#include <stdlib.h>
#include <stdio.h>
int main(void)
{
printf("void*: %lu\n", sizeof(void*));
printf("int: %lu\n", sizeof(int));
printf("long: %lu\n", sizeof(long));
printf("long long: %lu\n", sizeof(long long));
return 0;
}
$ gcc -Wall ganyo.c && ./a.out
void*: 8
int: 4
long: 8
long long: 8
あっ
$ ls -l /usr/lib*/ld-linux*
-rwxr-xr-x 1 root root 224848 Apr 16 03:40 /usr/lib32/ld-linux.so.2
lrwxrwxrwx 1 root root 42 Apr 16 03:40 /usr/lib64/ld-linux-x86-64.so.2 -> /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2
lrwxrwxrwx 1 root root 28 Apr 16 03:40 /usr/lib/ld-linux.so.2 -> i386-linux-gnu/ld-linux.so.2
This account is not set to public on notestock.
This account is not set to public on notestock.
This account is not set to public on notestock.
This account is not set to public on notestock.
This account is not set to public on notestock.