Thread View: cn.comp.security
12 messages
12 total messages
Started by NewBlue
Tue, 14 Oct 2003 01:37
extern与指针的指针变量
Author: NewBlue
Date: Tue, 14 Oct 2003 01:37
Date: Tue, 14 Oct 2003 01:37
127 lines
7248 bytes
7248 bytes
[tips] extern��ָ���ָ�����
alert7 �����ڣ�2003-09-08 13:02
extern��ָ���ָ�����
by alert7
gcc��һ��С����,�������Ѿ�֪�����ȽϷ�dz�����Dz�֪���Ŀ��ܻ����ƺü���Сʱ��
һֱ���������Ƕ���Ϊchar *argv[]��char **argv�ǵȼ۵ġ���������
Ҳһֱû�г��?���Խ��ҵ���Ϊchar *argv[]��char **argv�ǵȼ۵ģ�ԭ��
��һ��������ͨ�õġ�
���ǣ������һ��BUG������һ�죬���ƾ���֮�������Ƕ���ָ���ָ�����
�ǵĻ�������ԭ�ͣ�Ӧ�ö����ָ�����顣���������ְѾ���д�ɱ��ģ���ʹ������
��һЩ��·��
���µ��������ҳ�������ģ�table�������ָ�����飬��ʵ����ʵ��o.c�����ǵ���
���ṩ�������û��Դ���룬����ܲݲݵİ�table����Ϊextern void ** ;
[root@redhat73 root]# cat o.c
#include <stdio.h>
void * table[]={"0","1","2","3",NULL};
int test(void )
{
return 0;
}
[root@redhat73 root]# cat t.c
#include <stdio.h>
int main(int argc, char *argv[])
{
extern void **table;
int t;
printf("table %x\n",&table);
printf("&table[1] %x\n",&table[1]);
printf("table[1] %s\n",table[1]);
return 0;
}
[root@redhat73 root]# gcc -c t.c
[root@redhat73 root]# gcc -o t t.o o.o
[root@redhat73 root]# ./t
table 8049518
&table[1] 8048507 <-----������Ȼ����������Ҫ��
table[1] (null) <-----������dz�����
���������»�����
08048400 <main>:
8048400: 55 push %ebp
8048401: 89 e5 mov %esp,%ebp
8048403: 83 ec 08 sub $0x8,%esp
8048406: 83 ec 08 sub $0x8,%esp
8048409: 68 18 95 04 08 push $0x8049518 <------table��ַ
804840e: 68 d8 84 04 08 push $0x80484d8
8048413: e8 d8 fe ff ff call 80482f0 <_init+0x58>
8048418: 83 c4 10 add $0x10,%esp
804841b: 83 ec 08 sub $0x8,%esp
804841e: a1 18 95 04 08 mov 0x8049518,%eax <-----��0x8049518��ַ�е�ֵ�ŵ�eax��
8048423: 83 c0 04 add $0x4,%eax <-----�ٰ����ֵ��4������Ȼ�����ǵı����г���
8048426: 50 push %eax
8048427: 68 e2 84 04 08 push $0x80484e2
804842c: e8 bf fe ff ff call 80482f0 <_init+0x58>
8048431: 83 c4 10 add $0x10,%esp
8048434: 83 ec 08 sub $0x8,%esp
8048437: a1 18 95 04 08 mov 0x8049518,%eax
804843c: 83 c0 04 add $0x4,%eax
804843f: ff 30 pushl (%eax)
8048441: 68 f0 84 04 08 push $0x80484f0
8048446: e8 a5 fe ff ff call 80482f0 <_init+0x58>
804844b: 83 c4 10 add $0x10,%esp
804844e: b8 00 00 00 00 mov $0x0,%eax
8048453: c9 leave
8048454: c3 ret
�������°���ԭ�Ͷ����extern void *table[];
#include <stdio.h>
int main(int argc, char *argv[])
{
extern void *table[];
int t;
printf("table %x\n",&table);
printf("&table[1] %x\n",&table[1]);
printf("table[1] %s\n",table[1]);
return 0;
}
[root@redhat73 root]# gcc -c t.c
[root@redhat73 root]# gcc -o t t.o o.o
[root@redhat73 root]# ./t
table 8049508
&table[1] 804950c
table[1] 1
08048400 <main>:
8048400: 55 push %ebp
8048401: 89 e5 mov %esp,%ebp
8048403: 83 ec 08 sub $0x8,%esp
8048406: 83 ec 08 sub $0x8,%esp
8048409: 68 08 95 04 08 push $0x8049508
804840e: 68 c8 84 04 08 push $0x80484c8
8048413: e8 d8 fe ff ff call 80482f0 <_init+0x58>
8048418: 83 c4 10 add $0x10,%esp
804841b: 83 ec 08 sub $0x8,%esp
804841e: 68 0c 95 04 08 push $0x804950c <--------����Ͷ���
8048423: 68 d2 84 04 08 push $0x80484d2
8048428: e8 c3 fe ff ff call 80482f0 <_init+0x58>
804842d: 83 c4 10 add $0x10,%esp
8048430: 83 ec 08 sub $0x8,%esp
8048433: ff 35 0c 95 04 08 pushl 0x804950c
8048439: 68 e0 84 04 08 push $0x80484e0
804843e: e8 ad fe ff ff call 80482f0 <_init+0x58>
8048443: 83 c4 10 add $0x10,%esp
8048446: b8 00 00 00 00 mov $0x0,%eax
804844b: c9 leave
804844c: c3 ret
���ԣ����ǻ���Ҫ�ϸ��պ����ԭ�������塣
����һЩʵ�飬ָ���ָ���������extern����������Ҫע���ˣ�
��ʱ��ָ���ָ�������ָ������Ͳ���ͨ���ˡ�
--
NewBlue
�Դ����뿪���Ժ���һֱ�ȴ��������
Re: extern与指针的指针变量
Author: NewBlue
Date: Thu, 30 Oct 2003 13:46
Date: Thu, 30 Oct 2003 13:46
16 lines
2258 bytes
2258 bytes
��������û�а������ͷ�εģ���Ҹ�������ϲ���Ļ��⡣��ƪ����Ҳ������д�ģ�
��alert7д�ģ�����һ��ǿ���ˡ�
��һ�㶼��æ����������Ե��������վ���ҵ�������unixϵͳ�档
���Dz��ǹ㶫�ˣ�
**����� Wrote:
> �������Ƿ���������������������ߵĵ���ˮƽ��
> ָ����һֻ�ܲ˵���лл��
--
�д�����������Զ������һЩ���Ķ���������ķ����Թ���
Re: extern��ָ���ָ�����
Author: aiker
Date: Tue, 18 Nov 2003 13:09
Date: Tue, 18 Nov 2003 13:09
1 lines
1517 bytes
1517 bytes
ˮƽ���������ġ�
Re: extern与指针的指针变量
Author: NewBlue
Date: Wed, 19 Nov 2003 11:40
Date: Wed, 19 Nov 2003 11:40
10 lines
1755 bytes
1755 bytes
�����������ˣ������Ĺ������ꣿ
**aiker Wrote:
> ˮƽ���������ġ�
--
NewBlue
�Դ����뿪���Ժ���һֱ�ȴ��������
Re: extern��ָ���ָ�����
Author: Qing, Quan
Date: Wed, 19 Nov 2003 13:35
Date: Wed, 19 Nov 2003 13:35
153 lines
8191 bytes
8191 bytes
> 804841e: a1 18 95 04 08 mov 0x8049518,%eax <-----��
0x8049518��ַ�е�ֵ�ŵ�eax��
> 8048423: 83 c0 04 add $0x4,%eax <-----�ٰ���
��ֵ��4������Ȼ�����ǵı����г���
> table 8049518
> &table[1] 8048507 <-----������Ȼ����������Ҫ��
> table[1] (null) <-----������dz�����
0x8049518+0x04=0x804951c����ʹ�ӡ������զ��ϵ�ϵ��أ�:(
��ô����û�д?��
--
------
Qing, Quan
Center for Nanoscale Science and Technology
Peking University
Beijing, P.R. China
http://www.chem.pku.edu.cn/nanochemistry
"NewBlue" <NewBlue@yaako.com> д���ʼ� news:uad84zjij.fsf@yaako.com...
> [tips] extern��ָ���ָ�����
>
> alert7 �����ڣ�2003-09-08 13:02
>
> extern��ָ���ָ�����
>
> by alert7
>
> gcc��һ��С����,�������Ѿ�֪�����ȽϷ�dz�����Dz�֪���Ŀ��ܻ����ƺü���С
ʱ��
>
> һֱ���������Ƕ���Ϊchar *argv[]��char **argv�ǵȼ۵ġ���������
> Ҳһֱû�г��?���Խ��ҵ���Ϊchar *argv[]��char **argv�ǵȼ۵ģ�ԭ��
> ��һ��������ͨ�õġ�
> ���ǣ������һ��BUG������һ�죬���ƾ���֮�������Ƕ���ָ���ָ�����
> �ǵĻ�������ԭ�ͣ�Ӧ�ö����ָ�����顣���������ְѾ���д�ɱ��ģ���ʹ����
��
> ��һЩ��·��
>
> ���µ��������ҳ�������ģ�table�������ָ�����飬��ʵ����ʵ��o.c�����ǵ�
��
> ���ṩ�������û��Դ���룬����ܲݲݵİ�table����Ϊextern void ** ;
>
> [root@redhat73 root]# cat o.c
> #include <stdio.h>
> void * table[]={"0","1","2","3",NULL};
>
> int test(void )
> {
>
> return 0;
> }
>
> [root@redhat73 root]# cat t.c
> #include <stdio.h>
> int main(int argc, char *argv[])
> {
> extern void **table;
> int t;
>
> printf("table %x\n",&table);
> printf("&table[1] %x\n",&table[1]);
> printf("table[1] %s\n",table[1]);
>
> return 0;
> }
> [root@redhat73 root]# gcc -c t.c
> [root@redhat73 root]# gcc -o t t.o o.o
> [root@redhat73 root]# ./t
> table 8049518
> &table[1] 8048507 <-----������Ȼ����������Ҫ��
> table[1] (null) <-----������dz�����
>
> ���������»�����
> 08048400 <main>:
> 8048400: 55 push %ebp
> 8048401: 89 e5 mov %esp,%ebp
> 8048403: 83 ec 08 sub $0x8,%esp
> 8048406: 83 ec 08 sub $0x8,%esp
> 8048409: 68 18 95 04 08 push $0x8049518 <------table��ַ
> 804840e: 68 d8 84 04 08 push $0x80484d8
> 8048413: e8 d8 fe ff ff call 80482f0 <_init+0x58>
> 8048418: 83 c4 10 add $0x10,%esp
> 804841b: 83 ec 08 sub $0x8,%esp
> 804841e: a1 18 95 04 08 mov 0x8049518,%eax <-----��
0x8049518��ַ�е�ֵ�ŵ�eax��
> 8048423: 83 c0 04 add $0x4,%eax <-----�ٰ���
��ֵ��4������Ȼ�����ǵı����г���
> 8048426: 50 push %eax
> 8048427: 68 e2 84 04 08 push $0x80484e2
> 804842c: e8 bf fe ff ff call 80482f0 <_init+0x58>
> 8048431: 83 c4 10 add $0x10,%esp
> 8048434: 83 ec 08 sub $0x8,%esp
> 8048437: a1 18 95 04 08 mov 0x8049518,%eax
> 804843c: 83 c0 04 add $0x4,%eax
> 804843f: ff 30 pushl (%eax)
> 8048441: 68 f0 84 04 08 push $0x80484f0
> 8048446: e8 a5 fe ff ff call 80482f0 <_init+0x58>
> 804844b: 83 c4 10 add $0x10,%esp
> 804844e: b8 00 00 00 00 mov $0x0,%eax
> 8048453: c9 leave
> 8048454: c3 ret
>
> �������°���ԭ�Ͷ����extern void *table[];
> #include <stdio.h>
> int main(int argc, char *argv[])
> {
> extern void *table[];
> int t;
>
> printf("table %x\n",&table);
> printf("&table[1] %x\n",&table[1]);
> printf("table[1] %s\n",table[1]);
>
> return 0;
> }
> [root@redhat73 root]# gcc -c t.c
> [root@redhat73 root]# gcc -o t t.o o.o
> [root@redhat73 root]# ./t
> table 8049508
> &table[1] 804950c
> table[1] 1
> 08048400 <main>:
> 8048400: 55 push %ebp
> 8048401: 89 e5 mov %esp,%ebp
> 8048403: 83 ec 08 sub $0x8,%esp
> 8048406: 83 ec 08 sub $0x8,%esp
> 8048409: 68 08 95 04 08 push $0x8049508
> 804840e: 68 c8 84 04 08 push $0x80484c8
> 8048413: e8 d8 fe ff ff call 80482f0 <_init+0x58>
> 8048418: 83 c4 10 add $0x10,%esp
> 804841b: 83 ec 08 sub $0x8,%esp
> 804841e: 68 0c 95 04 08 push $0x804950c <--------�����
����
> 8048423: 68 d2 84 04 08 push $0x80484d2
> 8048428: e8 c3 fe ff ff call 80482f0 <_init+0x58>
> 804842d: 83 c4 10 add $0x10,%esp
> 8048430: 83 ec 08 sub $0x8,%esp
> 8048433: ff 35 0c 95 04 08 pushl 0x804950c
> 8048439: 68 e0 84 04 08 push $0x80484e0
> 804843e: e8 ad fe ff ff call 80482f0 <_init+0x58>
> 8048443: 83 c4 10 add $0x10,%esp
> 8048446: b8 00 00 00 00 mov $0x0,%eax
> 804844b: c9 leave
> 804844c: c3 ret
>
> ���ԣ����ǻ���Ҫ�ϸ��պ����ԭ�������塣
>
> ����һЩʵ�飬ָ���ָ���������extern����������Ҫע���ˣ�
> ��ʱ��ָ���ָ�������ָ������Ͳ���ͨ���ˡ�
> --
> NewBlue
> �Դ����뿪���Ժ���һֱ�ȴ��������
Re: extern��ָ���ָ�����
Author: nukq
Date: Thu, 20 Nov 2003 08:36
Date: Thu, 20 Nov 2003 08:36
174 lines
9063 bytes
9063 bytes
���岻ͬ�ˡ�*table[]��table�����飬��table������û�д洢�ռ�ģ���Ȼ���ʾ��
����ַ��talbe[0] table[1] ..�Ÿ�����4byte�Ŀռ䡣
����Ҫ����
o.c�����Ϊ
void *__table[]={"0","1","2","3",NULL};
void **table=__table;
"Qing, Quan" <skipme@263.net> д���ʼ� news:bpfrjc$17uo$1@mail.cn99.com...
> > 804841e: a1 18 95 04 08 mov 0x8049518,%eax <-----��
> 0x8049518��ַ�е�ֵ�ŵ�eax��
> > 8048423: 83 c0 04 add $0x4,%eax <-----�ٰ�
��
> ��ֵ��4������Ȼ�����ǵı����г���
>
> > table 8049518
> > &table[1] 8048507 <-----������Ȼ����������Ҫ��
> > table[1] (null) <-----������dz�����
>
> 0x8049518+0x04=0x804951c����ʹ�ӡ������զ��ϵ�ϵ��أ�:(
> ��ô����û�д?��
>
> --
> ------
> Qing, Quan
> Center for Nanoscale Science and Technology
> Peking University
> Beijing, P.R. China
> http://www.chem.pku.edu.cn/nanochemistry
> "NewBlue" <NewBlue@yaako.com> д���ʼ� news:uad84zjij.fsf@yaako.com...
> > [tips] extern��ָ���ָ�����
> >
> > alert7 �����ڣ�2003-09-08 13:02
> >
> > extern��ָ���ָ�����
> >
> > by alert7
> >
> > gcc��һ��С����,�������Ѿ�֪�����ȽϷ�dz�����Dz�֪���Ŀ��ܻ����ƺü���
С
> ʱ��
> >
> > һֱ���������Ƕ���Ϊchar *argv[]��char **argv�ǵȼ۵ġ���������
> > Ҳһֱû�г��?���Խ��ҵ���Ϊchar *argv[]��char **argv�ǵȼ۵ģ�ԭ��
> > ��һ��������ͨ�õġ�
> > ���ǣ������һ��BUG������һ�죬���ƾ���֮�������Ƕ���ָ���ָ���
��
> > �ǵĻ�������ԭ�ͣ�Ӧ�ö����ָ�����顣���������ְѾ���д�ɱ��ģ���ʹ��
��
> ��
> > ��һЩ��·��
> >
> > ���µ��������ҳ�������ģ�table�������ָ�����飬��ʵ����ʵ��o.c������
��
> ��
> > ���ṩ�������û��Դ���룬����ܲݲݵİ�table����Ϊextern void ** ;
> >
> > [root@redhat73 root]# cat o.c
> > #include <stdio.h>
> > void * table[]={"0","1","2","3",NULL};
> >
> > int test(void )
> > {
> >
> > return 0;
> > }
> >
> > [root@redhat73 root]# cat t.c
> > #include <stdio.h>
> > int main(int argc, char *argv[])
> > {
> > extern void **table;
> > int t;
> >
> > printf("table %x\n",&table);
> > printf("&table[1] %x\n",&table[1]);
> > printf("table[1] %s\n",table[1]);
> >
> > return 0;
> > }
> > [root@redhat73 root]# gcc -c t.c
> > [root@redhat73 root]# gcc -o t t.o o.o
> > [root@redhat73 root]# ./t
> > table 8049518
> > &table[1] 8048507 <-----������Ȼ����������Ҫ��
> > table[1] (null) <-----������dz�����
> >
> > ���������»�����
> > 08048400 <main>:
> > 8048400: 55 push %ebp
> > 8048401: 89 e5 mov %esp,%ebp
> > 8048403: 83 ec 08 sub $0x8,%esp
> > 8048406: 83 ec 08 sub $0x8,%esp
> > 8048409: 68 18 95 04 08 push $0x8049518 <------table��
ַ
> > 804840e: 68 d8 84 04 08 push $0x80484d8
> > 8048413: e8 d8 fe ff ff call 80482f0 <_init+0x58>
> > 8048418: 83 c4 10 add $0x10,%esp
> > 804841b: 83 ec 08 sub $0x8,%esp
> > 804841e: a1 18 95 04 08 mov 0x8049518,%eax <-----��
> 0x8049518��ַ�е�ֵ�ŵ�eax��
> > 8048423: 83 c0 04 add $0x4,%eax <-----�ٰ�
��
> ��ֵ��4������Ȼ�����ǵı����г���
> > 8048426: 50 push %eax
> > 8048427: 68 e2 84 04 08 push $0x80484e2
> > 804842c: e8 bf fe ff ff call 80482f0 <_init+0x58>
> > 8048431: 83 c4 10 add $0x10,%esp
> > 8048434: 83 ec 08 sub $0x8,%esp
> > 8048437: a1 18 95 04 08 mov 0x8049518,%eax
> > 804843c: 83 c0 04 add $0x4,%eax
> > 804843f: ff 30 pushl (%eax)
> > 8048441: 68 f0 84 04 08 push $0x80484f0
> > 8048446: e8 a5 fe ff ff call 80482f0 <_init+0x58>
> > 804844b: 83 c4 10 add $0x10,%esp
> > 804844e: b8 00 00 00 00 mov $0x0,%eax
> > 8048453: c9 leave
> > 8048454: c3 ret
> >
> > �������°���ԭ�Ͷ����extern void *table[];
> > #include <stdio.h>
> > int main(int argc, char *argv[])
> > {
> > extern void *table[];
> > int t;
> >
> > printf("table %x\n",&table);
> > printf("&table[1] %x\n",&table[1]);
> > printf("table[1] %s\n",table[1]);
> >
> > return 0;
> > }
> > [root@redhat73 root]# gcc -c t.c
> > [root@redhat73 root]# gcc -o t t.o o.o
> > [root@redhat73 root]# ./t
> > table 8049508
> > &table[1] 804950c
> > table[1] 1
> > 08048400 <main>:
> > 8048400: 55 push %ebp
> > 8048401: 89 e5 mov %esp,%ebp
> > 8048403: 83 ec 08 sub $0x8,%esp
> > 8048406: 83 ec 08 sub $0x8,%esp
> > 8048409: 68 08 95 04 08 push $0x8049508
> > 804840e: 68 c8 84 04 08 push $0x80484c8
> > 8048413: e8 d8 fe ff ff call 80482f0 <_init+0x58>
> > 8048418: 83 c4 10 add $0x10,%esp
> > 804841b: 83 ec 08 sub $0x8,%esp
> > 804841e: 68 0c 95 04 08 push $0x804950c <--------����
��
> ����
> > 8048423: 68 d2 84 04 08 push $0x80484d2
> > 8048428: e8 c3 fe ff ff call 80482f0 <_init+0x58>
> > 804842d: 83 c4 10 add $0x10,%esp
> > 8048430: 83 ec 08 sub $0x8,%esp
> > 8048433: ff 35 0c 95 04 08 pushl 0x804950c
> > 8048439: 68 e0 84 04 08 push $0x80484e0
> > 804843e: e8 ad fe ff ff call 80482f0 <_init+0x58>
> > 8048443: 83 c4 10 add $0x10,%esp
> > 8048446: b8 00 00 00 00 mov $0x0,%eax
> > 804844b: c9 leave
> > 804844c: c3 ret
> >
> > ���ԣ����ǻ���Ҫ�ϸ��պ����ԭ�������塣
> >
> > ����һЩʵ�飬ָ���ָ���������extern����������Ҫע���ˣ�
> > ��ʱ��ָ���ָ�������ָ������Ͳ���ͨ���ˡ�
> > --
> > NewBlue
> > �Դ����뿪���Ժ���һֱ�ȴ��������
>
>
Re: extern��ָ���ָ�����
Author: Qing, Quan
Date: Fri, 21 Nov 2003 02:45
Date: Fri, 21 Nov 2003 02:45
198 lines
9845 bytes
9845 bytes
�ҵ���˼�Ǵ�ӡ������ֵȷʵĪ�����Ȼ��������ַ�Ľ��û�д?�������
����ط����ˡ�
--
------
Qing, Quan
Center for Nanoscale Science and Technology
Peking University
Beijing, P.R. China
http://www.chem.pku.edu.cn/nanochemistry
"nukq" <simenking@sohu.com> д���ʼ� news:bphude$p0f$1@news.yaako.com...
> ���岻ͬ�ˡ�*table[]��table�����飬��table������û�д洢�ռ�ģ���Ȼ���ʾ
��
> ����ַ��talbe[0] table[1] ..�Ÿ�����4byte�Ŀռ䡣
>
> ����Ҫ����
> o.c�����Ϊ
>
> void *__table[]={"0","1","2","3",NULL};
> void **table=__table;
>
>
> "Qing, Quan" <skipme@263.net> д���ʼ� news:bpfrjc$17uo$1@mail.cn99.com...
> > > 804841e: a1 18 95 04 08 mov 0x8049518,%eax <-----��
> > 0x8049518��ַ�е�ֵ�ŵ�eax��
> > > 8048423: 83 c0 04 add $0x4,%eax <-----��
��
> ��
> > ��ֵ��4������Ȼ�����ǵı����г���
> >
> > > table 8049518
> > > &table[1] 8048507 <-----������Ȼ����������Ҫ��
> > > table[1] (null) <-----������dz�����
> >
> > 0x8049518+0x04=0x804951c����ʹ�ӡ������զ��ϵ�ϵ��أ�:(
> > ��ô����û�д?��
> >
> > --
> > ------
> > Qing, Quan
> > Center for Nanoscale Science and Technology
> > Peking University
> > Beijing, P.R. China
> > http://www.chem.pku.edu.cn/nanochemistry
> > "NewBlue" <NewBlue@yaako.com> д���ʼ� news:uad84zjij.fsf@yaako.com...
> > > [tips] extern��ָ���ָ�����
> > >
> > > alert7 �����ڣ�2003-09-08 13:02
> > >
> > > extern��ָ���ָ�����
> > >
> > > by alert7
> > >
> > > gcc��һ��С����,�������Ѿ�֪�����ȽϷ�dz�����Dz�֪���Ŀ��ܻ����ƺü�
��
> С
> > ʱ��
> > >
> > > һֱ���������Ƕ���Ϊchar *argv[]��char **argv�ǵȼ۵ġ���������
> > > Ҳһֱû�г��?���Խ��ҵ���Ϊchar *argv[]��char **argv�ǵȼ۵ģ�ԭ��
> > > ��һ��������ͨ�õġ�
> > > ���ǣ������һ��BUG������һ�죬���ƾ���֮�������Ƕ���ָ���ָ��
��
> ��
> > > �ǵĻ�������ԭ�ͣ�Ӧ�ö����ָ�����顣���������ְѾ���д�ɱ��ģ���ʹ
��
> ��
> > ��
> > > ��һЩ��·��
> > >
> > > ���µ��������ҳ�������ģ�table�������ָ�����飬��ʵ����ʵ��o.c����
��
> ��
> > ��
> > > ���ṩ�������û��Դ���룬����ܲݲݵİ�table����Ϊextern void ** ;
> > >
> > > [root@redhat73 root]# cat o.c
> > > #include <stdio.h>
> > > void * table[]={"0","1","2","3",NULL};
> > >
> > > int test(void )
> > > {
> > >
> > > return 0;
> > > }
> > >
> > > [root@redhat73 root]# cat t.c
> > > #include <stdio.h>
> > > int main(int argc, char *argv[])
> > > {
> > > extern void **table;
> > > int t;
> > >
> > > printf("table %x\n",&table);
> > > printf("&table[1] %x\n",&table[1]);
> > > printf("table[1] %s\n",table[1]);
> > >
> > > return 0;
> > > }
> > > [root@redhat73 root]# gcc -c t.c
> > > [root@redhat73 root]# gcc -o t t.o o.o
> > > [root@redhat73 root]# ./t
> > > table 8049518
> > > &table[1] 8048507 <-----������Ȼ����������Ҫ��
> > > table[1] (null) <-----������dz�����
> > >
> > > ���������»�����
> > > 08048400 <main>:
> > > 8048400: 55 push %ebp
> > > 8048401: 89 e5 mov %esp,%ebp
> > > 8048403: 83 ec 08 sub $0x8,%esp
> > > 8048406: 83 ec 08 sub $0x8,%esp
> > > 8048409: 68 18 95 04 08 push $0x8049518 <------table
��
> ַ
> > > 804840e: 68 d8 84 04 08 push $0x80484d8
> > > 8048413: e8 d8 fe ff ff call 80482f0 <_init+0x58>
> > > 8048418: 83 c4 10 add $0x10,%esp
> > > 804841b: 83 ec 08 sub $0x8,%esp
> > > 804841e: a1 18 95 04 08 mov 0x8049518,%eax <-----��
> > 0x8049518��ַ�е�ֵ�ŵ�eax��
> > > 8048423: 83 c0 04 add $0x4,%eax <-----��
��
> ��
> > ��ֵ��4������Ȼ�����ǵı����г���
> > > 8048426: 50 push %eax
> > > 8048427: 68 e2 84 04 08 push $0x80484e2
> > > 804842c: e8 bf fe ff ff call 80482f0 <_init+0x58>
> > > 8048431: 83 c4 10 add $0x10,%esp
> > > 8048434: 83 ec 08 sub $0x8,%esp
> > > 8048437: a1 18 95 04 08 mov 0x8049518,%eax
> > > 804843c: 83 c0 04 add $0x4,%eax
> > > 804843f: ff 30 pushl (%eax)
> > > 8048441: 68 f0 84 04 08 push $0x80484f0
> > > 8048446: e8 a5 fe ff ff call 80482f0 <_init+0x58>
> > > 804844b: 83 c4 10 add $0x10,%esp
> > > 804844e: b8 00 00 00 00 mov $0x0,%eax
> > > 8048453: c9 leave
> > > 8048454: c3 ret
> > >
> > > �������°���ԭ�Ͷ����extern void *table[];
> > > #include <stdio.h>
> > > int main(int argc, char *argv[])
> > > {
> > > extern void *table[];
> > > int t;
> > >
> > > printf("table %x\n",&table);
> > > printf("&table[1] %x\n",&table[1]);
> > > printf("table[1] %s\n",table[1]);
> > >
> > > return 0;
> > > }
> > > [root@redhat73 root]# gcc -c t.c
> > > [root@redhat73 root]# gcc -o t t.o o.o
> > > [root@redhat73 root]# ./t
> > > table 8049508
> > > &table[1] 804950c
> > > table[1] 1
> > > 08048400 <main>:
> > > 8048400: 55 push %ebp
> > > 8048401: 89 e5 mov %esp,%ebp
> > > 8048403: 83 ec 08 sub $0x8,%esp
> > > 8048406: 83 ec 08 sub $0x8,%esp
> > > 8048409: 68 08 95 04 08 push $0x8049508
> > > 804840e: 68 c8 84 04 08 push $0x80484c8
> > > 8048413: e8 d8 fe ff ff call 80482f0 <_init+0x58>
> > > 8048418: 83 c4 10 add $0x10,%esp
> > > 804841b: 83 ec 08 sub $0x8,%esp
> > > 804841e: 68 0c 95 04 08 push $0x804950c <--------��
��
> ��
> > ����
> > > 8048423: 68 d2 84 04 08 push $0x80484d2
> > > 8048428: e8 c3 fe ff ff call 80482f0 <_init+0x58>
> > > 804842d: 83 c4 10 add $0x10,%esp
> > > 8048430: 83 ec 08 sub $0x8,%esp
> > > 8048433: ff 35 0c 95 04 08 pushl 0x804950c
> > > 8048439: 68 e0 84 04 08 push $0x80484e0
> > > 804843e: e8 ad fe ff ff call 80482f0 <_init+0x58>
> > > 8048443: 83 c4 10 add $0x10,%esp
> > > 8048446: b8 00 00 00 00 mov $0x0,%eax
> > > 804844b: c9 leave
> > > 804844c: c3 ret
> > >
> > > ���ԣ����ǻ���Ҫ�ϸ��պ����ԭ�������塣
> > >
> > > ����һЩʵ�飬ָ���ָ���������extern����������Ҫע���ˣ�
> > > ��ʱ��ָ���ָ�������ָ������Ͳ���ͨ���ˡ�
> > > --
> > > NewBlue
> > > �Դ����뿪���Ժ���һֱ�ȴ��������
> >
> >
>
>
Re: extern��ָ���ָ�����
Author: nukq
Date: Fri, 21 Nov 2003 08:14
Date: Fri, 21 Nov 2003 08:14
218 lines
10559 bytes
10559 bytes
�ǰ�������϶�û��ġ�
����table�ĵ�ַ�����ˡ�
"Qing, Quan" <skipme@nospam.263.net> д���ʼ�
news:bpjubc$1f2f$1@mail.cn99.com...
> �ҵ���˼�Ǵ�ӡ������ֵȷʵĪ�����Ȼ��������ַ�Ľ��û�д?�����
��
> ����ط����ˡ�
>
> --
> ------
> Qing, Quan
> Center for Nanoscale Science and Technology
> Peking University
> Beijing, P.R. China
> http://www.chem.pku.edu.cn/nanochemistry
>
>
> "nukq" <simenking@sohu.com> д���ʼ� news:bphude$p0f$1@news.yaako.com...
> > ���岻ͬ�ˡ�*table[]��table�����飬��table������û�д洢�ռ�ģ���Ȼ���
ʾ
> ��
> > ����ַ��talbe[0] table[1] ..�Ÿ�����4byte�Ŀռ䡣
> >
> > ����Ҫ����
> > o.c�����Ϊ
> >
> > void *__table[]={"0","1","2","3",NULL};
> > void **table=__table;
> >
> >
> > "Qing, Quan" <skipme@263.net> д���ʼ�
news:bpfrjc$17uo$1@mail.cn99.com...
> > > > 804841e: a1 18 95 04 08 mov 0x8049518,%eax <-----
��
> > > 0x8049518��ַ�е�ֵ�ŵ�eax��
> > > > 8048423: 83 c0 04 add $0x4,%eax <-----
��
> ��
> > ��
> > > ��ֵ��4������Ȼ�����ǵı����г���
> > >
> > > > table 8049518
> > > > &table[1] 8048507 <-----������Ȼ����������Ҫ��
> > > > table[1] (null) <-----������dz�����
> > >
> > > 0x8049518+0x04=0x804951c����ʹ�ӡ������զ��ϵ�ϵ��أ�:(
> > > ��ô����û�д?��
> > >
> > > --
> > > ------
> > > Qing, Quan
> > > Center for Nanoscale Science and Technology
> > > Peking University
> > > Beijing, P.R. China
> > > http://www.chem.pku.edu.cn/nanochemistry
> > > "NewBlue" <NewBlue@yaako.com> д���ʼ� news:uad84zjij.fsf@yaako.com...
> > > > [tips] extern��ָ���ָ�����
> > > >
> > > > alert7 �����ڣ�2003-09-08 13:02
> > > >
> > > > extern��ָ���ָ�����
> > > >
> > > > by alert7
> > > >
> > > > gcc��һ��С����,�������Ѿ�֪�����ȽϷ�dz�����Dz�֪���Ŀ��ܻ����ƺ�
��
> ��
> > С
> > > ʱ��
> > > >
> > > > һֱ���������Ƕ���Ϊchar *argv[]��char **argv�ǵȼ۵ġ���������
> > > > Ҳһֱû�г��?���Խ��ҵ���Ϊchar *argv[]��char **argv�ǵȼ۵ģ�ԭ
��
> > > > ��һ��������ͨ�õġ�
> > > > ���ǣ������һ��BUG������һ�죬���ƾ���֮�������Ƕ���ָ���ָ
��
> ��
> > ��
> > > > �ǵĻ�������ԭ�ͣ�Ӧ�ö����ָ�����顣���������ְѾ���д�ɱ��ģ���
ʹ
> ��
> > ��
> > > ��
> > > > ��һЩ��·��
> > > >
> > > > ���µ��������ҳ�������ģ�table�������ָ�����飬��ʵ����ʵ��o.c��
��
> ��
> > ��
> > > ��
> > > > ���ṩ�������û��Դ���룬����ܲݲݵİ�table����Ϊextern void ** ;
> > > >
> > > > [root@redhat73 root]# cat o.c
> > > > #include <stdio.h>
> > > > void * table[]={"0","1","2","3",NULL};
> > > >
> > > > int test(void )
> > > > {
> > > >
> > > > return 0;
> > > > }
> > > >
> > > > [root@redhat73 root]# cat t.c
> > > > #include <stdio.h>
> > > > int main(int argc, char *argv[])
> > > > {
> > > > extern void **table;
> > > > int t;
> > > >
> > > > printf("table %x\n",&table);
> > > > printf("&table[1] %x\n",&table[1]);
> > > > printf("table[1] %s\n",table[1]);
> > > >
> > > > return 0;
> > > > }
> > > > [root@redhat73 root]# gcc -c t.c
> > > > [root@redhat73 root]# gcc -o t t.o o.o
> > > > [root@redhat73 root]# ./t
> > > > table 8049518
> > > > &table[1] 8048507 <-----������Ȼ����������Ҫ��
> > > > table[1] (null) <-----������dz�����
> > > >
> > > > ���������»�����
> > > > 08048400 <main>:
> > > > 8048400: 55 push %ebp
> > > > 8048401: 89 e5 mov %esp,%ebp
> > > > 8048403: 83 ec 08 sub $0x8,%esp
> > > > 8048406: 83 ec 08 sub $0x8,%esp
> > > > 8048409: 68 18 95 04 08 push $0x8049518
<------table
> ��
> > ַ
> > > > 804840e: 68 d8 84 04 08 push $0x80484d8
> > > > 8048413: e8 d8 fe ff ff call 80482f0 <_init+0x58>
> > > > 8048418: 83 c4 10 add $0x10,%esp
> > > > 804841b: 83 ec 08 sub $0x8,%esp
> > > > 804841e: a1 18 95 04 08 mov 0x8049518,%eax <-----
��
> > > 0x8049518��ַ�е�ֵ�ŵ�eax��
> > > > 8048423: 83 c0 04 add $0x4,%eax <-----
��
> ��
> > ��
> > > ��ֵ��4������Ȼ�����ǵı����г���
> > > > 8048426: 50 push %eax
> > > > 8048427: 68 e2 84 04 08 push $0x80484e2
> > > > 804842c: e8 bf fe ff ff call 80482f0 <_init+0x58>
> > > > 8048431: 83 c4 10 add $0x10,%esp
> > > > 8048434: 83 ec 08 sub $0x8,%esp
> > > > 8048437: a1 18 95 04 08 mov 0x8049518,%eax
> > > > 804843c: 83 c0 04 add $0x4,%eax
> > > > 804843f: ff 30 pushl (%eax)
> > > > 8048441: 68 f0 84 04 08 push $0x80484f0
> > > > 8048446: e8 a5 fe ff ff call 80482f0 <_init+0x58>
> > > > 804844b: 83 c4 10 add $0x10,%esp
> > > > 804844e: b8 00 00 00 00 mov $0x0,%eax
> > > > 8048453: c9 leave
> > > > 8048454: c3 ret
> > > >
> > > > �������°���ԭ�Ͷ����extern void *table[];
> > > > #include <stdio.h>
> > > > int main(int argc, char *argv[])
> > > > {
> > > > extern void *table[];
> > > > int t;
> > > >
> > > > printf("table %x\n",&table);
> > > > printf("&table[1] %x\n",&table[1]);
> > > > printf("table[1] %s\n",table[1]);
> > > >
> > > > return 0;
> > > > }
> > > > [root@redhat73 root]# gcc -c t.c
> > > > [root@redhat73 root]# gcc -o t t.o o.o
> > > > [root@redhat73 root]# ./t
> > > > table 8049508
> > > > &table[1] 804950c
> > > > table[1] 1
> > > > 08048400 <main>:
> > > > 8048400: 55 push %ebp
> > > > 8048401: 89 e5 mov %esp,%ebp
> > > > 8048403: 83 ec 08 sub $0x8,%esp
> > > > 8048406: 83 ec 08 sub $0x8,%esp
> > > > 8048409: 68 08 95 04 08 push $0x8049508
> > > > 804840e: 68 c8 84 04 08 push $0x80484c8
> > > > 8048413: e8 d8 fe ff ff call 80482f0 <_init+0x58>
> > > > 8048418: 83 c4 10 add $0x10,%esp
> > > > 804841b: 83 ec 08 sub $0x8,%esp
> > > > 804841e: 68 0c 95 04 08 push $0x804950c <--------
��
> ��
> > ��
> > > ����
> > > > 8048423: 68 d2 84 04 08 push $0x80484d2
> > > > 8048428: e8 c3 fe ff ff call 80482f0 <_init+0x58>
> > > > 804842d: 83 c4 10 add $0x10,%esp
> > > > 8048430: 83 ec 08 sub $0x8,%esp
> > > > 8048433: ff 35 0c 95 04 08 pushl 0x804950c
> > > > 8048439: 68 e0 84 04 08 push $0x80484e0
> > > > 804843e: e8 ad fe ff ff call 80482f0 <_init+0x58>
> > > > 8048443: 83 c4 10 add $0x10,%esp
> > > > 8048446: b8 00 00 00 00 mov $0x0,%eax
> > > > 804844b: c9 leave
> > > > 804844c: c3 ret
> > > >
> > > > ���ԣ����ǻ���Ҫ�ϸ��պ����ԭ�������塣
> > > >
> > > > ����һЩʵ�飬ָ���ָ���������extern����������Ҫע���ˣ�
> > > > ��ʱ��ָ���ָ�������ָ������Ͳ���ͨ���ˡ�
> > > > --
> > > > NewBlue
> > > > �Դ����뿪���Ժ���һֱ�ȴ��������
> > >
> > >
> >
> >
>
>
Re: extern��ָ���ָ�����
Author: nukq
Date: Fri, 21 Nov 2003 10:38
Date: Fri, 21 Nov 2003 10:38
257 lines
11396 bytes
11396 bytes
����������ʵ��:
o.c:
char *table[]={"0","1","2","3",NULL};
char **ptable=table;
t.c:
#include <stdio.h>
void main()
{
extern char **table;
extern char **ptable;
printf("%p\n%p\n",table,ptable);
return;
}
00401320
00402010
"nukq" <simenking@sohu.com> д���ʼ� news:bpkhhd$2bc$1@news.yaako.com...
> �ǰ�������϶�û��ġ�
> ����table�ĵ�ַ�����ˡ�
> "Qing, Quan" <skipme@nospam.263.net> д���ʼ�
> news:bpjubc$1f2f$1@mail.cn99.com...
> > �ҵ���˼�Ǵ�ӡ������ֵȷʵĪ�����Ȼ��������ַ�Ľ��û�д?���
��
> ��
> > ����ط����ˡ�
> >
> > --
> > ------
> > Qing, Quan
> > Center for Nanoscale Science and Technology
> > Peking University
> > Beijing, P.R. China
> > http://www.chem.pku.edu.cn/nanochemistry
> >
> >
> > "nukq" <simenking@sohu.com> д���ʼ� news:bphude$p0f$1@news.yaako.com...
> > > ���岻ͬ�ˡ�*table[]��table�����飬��table������û�д洢�ռ�ģ���Ȼ��
��
> ʾ
> > ��
> > > ����ַ��talbe[0] table[1] ..�Ÿ�����4byte�Ŀռ䡣
> > >
> > > ����Ҫ����
> > > o.c�����Ϊ
> > >
> > > void *__table[]={"0","1","2","3",NULL};
> > > void **table=__table;
> > >
> > >
> > > "Qing, Quan" <skipme@263.net> д���ʼ�
> news:bpfrjc$17uo$1@mail.cn99.com...
> > > > > 804841e: a1 18 95 04 08 mov 0x8049518,%eax
<-----
> ��
> > > > 0x8049518��ַ�е�ֵ�ŵ�eax��
> > > > > 8048423: 83 c0 04 add $0x4,%eax
<-----
> ��
> > ��
> > > ��
> > > > ��ֵ��4������Ȼ�����ǵı����г���
> > > >
> > > > > table 8049518
> > > > > &table[1] 8048507 <-----������Ȼ����������Ҫ��
> > > > > table[1] (null) <-----������dz�����
> > > >
> > > > 0x8049518+0x04=0x804951c����ʹ�ӡ������զ��ϵ�ϵ��أ�:(
> > > > ��ô����û�д?��
> > > >
> > > > --
> > > > ------
> > > > Qing, Quan
> > > > Center for Nanoscale Science and Technology
> > > > Peking University
> > > > Beijing, P.R. China
> > > > http://www.chem.pku.edu.cn/nanochemistry
> > > > "NewBlue" <NewBlue@yaako.com> д���ʼ�
news:uad84zjij.fsf@yaako.com...
> > > > > [tips] extern��ָ���ָ�����
> > > > >
> > > > > alert7 �����ڣ�2003-09-08 13:02
> > > > >
> > > > > extern��ָ���ָ�����
> > > > >
> > > > > by alert7
> > > > >
> > > > > gcc��һ��С����,�������Ѿ�֪�����ȽϷ�dz�����Dz�֪���Ŀ��ܻ�����
��
> ��
> > ��
> > > С
> > > > ʱ��
> > > > >
> > > > > һֱ���������Ƕ���Ϊchar *argv[]��char **argv�ǵȼ۵ġ���������
> > > > > Ҳһֱû�г��?���Խ��ҵ���Ϊchar *argv[]��char **argv�ǵȼ۵ģ�
ԭ
> ��
> > > > > ��һ��������ͨ�õġ�
> > > > > ���ǣ������һ��BUG������һ�죬���ƾ���֮�������Ƕ���ָ���
ָ
> ��
> > ��
> > > ��
> > > > > �ǵĻ�������ԭ�ͣ�Ӧ�ö����ָ�����顣���������ְѾ���д�ɱ��ģ�
��
> ʹ
> > ��
> > > ��
> > > > ��
> > > > > ��һЩ��·��
> > > > >
> > > > > ���µ��������ҳ�������ģ�table�������ָ�����飬��ʵ����ʵ��o.c
��
> ��
> > ��
> > > ��
> > > > ��
> > > > > ���ṩ�������û��Դ���룬����ܲݲݵİ�table����Ϊextern void **
;
> > > > >
> > > > > [root@redhat73 root]# cat o.c
> > > > > #include <stdio.h>
> > > > > void * table[]={"0","1","2","3",NULL};
> > > > >
> > > > > int test(void )
> > > > > {
> > > > >
> > > > > return 0;
> > > > > }
> > > > >
> > > > > [root@redhat73 root]# cat t.c
> > > > > #include <stdio.h>
> > > > > int main(int argc, char *argv[])
> > > > > {
> > > > > extern void **table;
> > > > > int t;
> > > > >
> > > > > printf("table %x\n",&table);
> > > > > printf("&table[1] %x\n",&table[1]);
> > > > > printf("table[1] %s\n",table[1]);
> > > > >
> > > > > return 0;
> > > > > }
> > > > > [root@redhat73 root]# gcc -c t.c
> > > > > [root@redhat73 root]# gcc -o t t.o o.o
> > > > > [root@redhat73 root]# ./t
> > > > > table 8049518
> > > > > &table[1] 8048507 <-----������Ȼ����������Ҫ��
> > > > > table[1] (null) <-----������dz�����
> > > > >
> > > > > ���������»�����
> > > > > 08048400 <main>:
> > > > > 8048400: 55 push %ebp
> > > > > 8048401: 89 e5 mov %esp,%ebp
> > > > > 8048403: 83 ec 08 sub $0x8,%esp
> > > > > 8048406: 83 ec 08 sub $0x8,%esp
> > > > > 8048409: 68 18 95 04 08 push $0x8049518
> <------table
> > ��
> > > ַ
> > > > > 804840e: 68 d8 84 04 08 push $0x80484d8
> > > > > 8048413: e8 d8 fe ff ff call 80482f0 <_init+0x58>
> > > > > 8048418: 83 c4 10 add $0x10,%esp
> > > > > 804841b: 83 ec 08 sub $0x8,%esp
> > > > > 804841e: a1 18 95 04 08 mov 0x8049518,%eax
<-----
> ��
> > > > 0x8049518��ַ�е�ֵ�ŵ�eax��
> > > > > 8048423: 83 c0 04 add $0x4,%eax
<-----
> ��
> > ��
> > > ��
> > > > ��ֵ��4������Ȼ�����ǵı����г���
> > > > > 8048426: 50 push %eax
> > > > > 8048427: 68 e2 84 04 08 push $0x80484e2
> > > > > 804842c: e8 bf fe ff ff call 80482f0 <_init+0x58>
> > > > > 8048431: 83 c4 10 add $0x10,%esp
> > > > > 8048434: 83 ec 08 sub $0x8,%esp
> > > > > 8048437: a1 18 95 04 08 mov 0x8049518,%eax
> > > > > 804843c: 83 c0 04 add $0x4,%eax
> > > > > 804843f: ff 30 pushl (%eax)
> > > > > 8048441: 68 f0 84 04 08 push $0x80484f0
> > > > > 8048446: e8 a5 fe ff ff call 80482f0 <_init+0x58>
> > > > > 804844b: 83 c4 10 add $0x10,%esp
> > > > > 804844e: b8 00 00 00 00 mov $0x0,%eax
> > > > > 8048453: c9 leave
> > > > > 8048454: c3 ret
> > > > >
> > > > > �������°���ԭ�Ͷ����extern void *table[];
> > > > > #include <stdio.h>
> > > > > int main(int argc, char *argv[])
> > > > > {
> > > > > extern void *table[];
> > > > > int t;
> > > > >
> > > > > printf("table %x\n",&table);
> > > > > printf("&table[1] %x\n",&table[1]);
> > > > > printf("table[1] %s\n",table[1]);
> > > > >
> > > > > return 0;
> > > > > }
> > > > > [root@redhat73 root]# gcc -c t.c
> > > > > [root@redhat73 root]# gcc -o t t.o o.o
> > > > > [root@redhat73 root]# ./t
> > > > > table 8049508
> > > > > &table[1] 804950c
> > > > > table[1] 1
> > > > > 08048400 <main>:
> > > > > 8048400: 55 push %ebp
> > > > > 8048401: 89 e5 mov %esp,%ebp
> > > > > 8048403: 83 ec 08 sub $0x8,%esp
> > > > > 8048406: 83 ec 08 sub $0x8,%esp
> > > > > 8048409: 68 08 95 04 08 push $0x8049508
> > > > > 804840e: 68 c8 84 04 08 push $0x80484c8
> > > > > 8048413: e8 d8 fe ff ff call 80482f0 <_init+0x58>
> > > > > 8048418: 83 c4 10 add $0x10,%esp
> > > > > 804841b: 83 ec 08 sub $0x8,%esp
> > > > > 804841e: 68 0c 95 04 08 push $0x804950c
<--------
> ��
> > ��
> > > ��
> > > > ����
> > > > > 8048423: 68 d2 84 04 08 push $0x80484d2
> > > > > 8048428: e8 c3 fe ff ff call 80482f0 <_init+0x58>
> > > > > 804842d: 83 c4 10 add $0x10,%esp
> > > > > 8048430: 83 ec 08 sub $0x8,%esp
> > > > > 8048433: ff 35 0c 95 04 08 pushl 0x804950c
> > > > > 8048439: 68 e0 84 04 08 push $0x80484e0
> > > > > 804843e: e8 ad fe ff ff call 80482f0 <_init+0x58>
> > > > > 8048443: 83 c4 10 add $0x10,%esp
> > > > > 8048446: b8 00 00 00 00 mov $0x0,%eax
> > > > > 804844b: c9 leave
> > > > > 804844c: c3 ret
> > > > >
> > > > > ���ԣ����ǻ���Ҫ�ϸ��պ����ԭ�������塣
> > > > >
> > > > > ����һЩʵ�飬ָ���ָ���������extern����������Ҫע���ˣ�
> > > > > ��ʱ��ָ���ָ�������ָ������Ͳ���ͨ���ˡ�
> > > > > --
> > > > > NewBlue
> > > > > �Դ����뿪���Ժ���һֱ�ȴ��������
> > > >
> > > >
> > >
> > >
> >
> >
>
>
Re: extern与指针的指针变量
Author: NewBlue
Date: Fri, 21 Nov 2003 11:15
Date: Fri, 21 Nov 2003 11:15
20 lines
2306 bytes
2306 bytes
���۵�ʱ���벻Ҫ�ϳ�β��
**Qing, QuanWrote:
>> 804841e: a1 18 95 04 08 mov 0x8049518,%eax <-----��
> 0x8049518��ַ�е�ֵ�ŵ�eax��
>> 8048423: 83 c0 04 add $0x4,%eax <-----�ٰ���
> ��ֵ��4������Ȼ�����ǵı����г���
>> table 8049518
>> &table[1] 8048507 <-----������Ȼ����������Ҫ��
>> table[1] (null) <-----������dz�����
> 0x8049518+0x04=0x804951c����ʹ�ӡ������զ��ϵ�ϵ��أ�:(
> ��ô����û�д?��
--
NewBlue
�Դ����뿪���Ժ���һֱ�ȴ��������
Re: extern与指针的指针变量
Author: NewBlue
Date: Fri, 21 Nov 2003 11:16
Date: Fri, 21 Nov 2003 11:16
17 lines
2122 bytes
2122 bytes
���۵�ʱ���벻Ҫ����̫���Ļظ�
**nukq Wrote:
> ���岻ͬ�ˡ�*table[]��table�����飬��table������û�д洢�ռ�ģ���Ȼ���ʾ��
> ����ַ��talbe[0] table[1] ..�Ÿ�����4byte�Ŀռ䡣
> ����Ҫ����
> o.c�����Ϊ
> void *__table[]={"0","1","2","3",NULL};
> void **table=__table;
--
NewBlue
�Դ����뿪���Ժ���һֱ�ȴ��������
Re: extern与指针的指针变量
Author: gnuisv
Date: Fri, 21 Nov 2003 19:13
Date: Fri, 21 Nov 2003 19:13
3 lines
1724 bytes
1724 bytes
˵�˰��죬main��ʼ����ʱ�����ĸ��� int main(int argc,char **argv)����...,char *argv[])?
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads