|
From: | Russell Shaw |
Subject: | Re: [avr-gcc-list] Strange problem - Pointer not null when declared |
Date: | Mon, 30 Jul 2007 12:42:04 +1000 |
User-agent: | Thunderbird 1.5.0.2 (X11/20060501) |
Gerard Marull Paretas wrote:
Hello.I've been trying to find the reason of a curious bug, but I can't. It's so strange: I create a new structure that inside contains two pointers to other structures and one uint8_t. However, pointers are not NULL when created, so that makes my code to not work as it should. I've seen that when declaring that structure with static attribute all works fine (or making it global), pointers value is null when function starts. Creating the structure in other code part creates the same problem...I really don't know what it can be... I attached the disassembly of the two code versions generated while debugging (with C source lines), one with static attribute and the other without.
Creating any non-global data will have random values. Only if declared outside a function will they be initialized to zeros.
[Prev in Thread] | Current Thread | [Next in Thread] |