Re: [[uClinux-dev] global variable initialization]

From: Jesu Francois Michelangelo Serafica (jesu.francois@usa.net)
Date: Fri Feb 23 2001 - 04:56:26 EST


Hi,

Was that a typo or did you actually assign the address of i to *ip? I dont
think thats what you wanted.

Mikee

kimsh@mail.rednix.com wrote:
Hello,

I am using Aplio's uclinux and toolchains for ARM7TDMI.

I executed the following program.


        int i = 1234;
        int *ip = &i;

        main()
        {
                printf("*ip = %d\n", *ip);
                printf("ip = 0x%x, &i = 0x%x\n", ip, &i);
        }


The first printf statement outputs a garbage value, but not 1234.
Also, the second printf statement prints the different values for ip and &i.

It seems that the initailization of global variables to the addresses of
any other variables does not work.

A program uses global variables of fuction pointer type, and initializes
them.
So, the program does not call the functions using that function pointers,
correctly.

Is there any solution for that problem?




-- 
Kim, Seong-Hoon
kimsh@rednix.com
Tel. +82-42-828-7366
Rednix Ltd. Co. Room 502, Dong-a Officetel
Bong-myung-dong Yusong-gu, Taejon, Korea


This message resent by the uclinux-dev@uclinux.org list server
http://www.uClinux.org/


Michelangelo A. Serafica

____________________________________________________________________
Get free email and a permanent address at http://www.netaddress.com/?N=1
This message resent by the uclinux-dev@uclinux.org list server http://www.uClinux.org/


This archive was generated by hypermail 2.1.4 : Thu Sep 19 2002 - 13:19:31 EDT