??? 04/08/09 09:03 Read: times Msg Score: +1 +1 Good Answer/Helpful |
#164486 - Array or pointer similar Responding to: ???'s previous message |
You can have an extern declaration of an array, allowing other modules to use the array - just as they would use a pointer - without knowing the actual location of the array.
So adding an extra pointer would not be needed even if you split the code into multiple modules. Another thing is of course that you can write: *(array + index) or pointer [ index ] But using an array instead of a pointer (the data type, not the way of writing the access) has - at least for some processors - an advantage when it comes to addressing modes. The compiler knows that the array has a fixed address so *(array + index) or array[index] may be converted to a constant if "index" is a constant. And not having a pointer also means one variable less in RAM. And without the pointer in RAM, your code will not be able to somehow overwrite this pointer later resulting in all future pointer accesses reading from the wrong location or overwriting even more variables. |
Topic | Author | Date |
How to access memory mapped 8255 with SDCC? | 01/01/70 00:00 | |
also asked here: | 01/01/70 00:00 | |
8255 with SDCC | 01/01/70 00:00 | |
Wrong question? | 01/01/70 00:00 | |
It's C | 01/01/70 00:00 | |
not on the 8051 | 01/01/70 00:00 | |
Oh yes it is! | 01/01/70 00:00 | |
Use XBYTE macro | 01/01/70 00:00 | |
Isn't there a problem with that? | 01/01/70 00:00 | |
Oops. I used a wrong example | 01/01/70 00:00 | |
Portability | 01/01/70 00:00 | |
like this... | 01/01/70 00:00 | |
How about a macro in ASM, callable from 'C'? | 01/01/70 00:00 | |
This is HOW I will Prefer | 01/01/70 00:00 | |
LST output of my previously posted code | 01/01/70 00:00 | |
Try the comparison | 01/01/70 00:00 | |
Unnecessarily complicated! | 01/01/70 00:00 | |
NOT UNNECESSARILY | 01/01/70 00:00 | |
You are mistaken | 01/01/70 00:00 | |
Array or pointer similar | 01/01/70 00:00 | |
That should not be necessary | 01/01/70 00:00 | |
SFRX(...,. ..) worked | 01/01/70 00:00 | |
SFRX - presumably, that's an SDCC extension? | 01/01/70 00:00 | |
Found it! | 01/01/70 00:00 | |
RE: Found it!![]() | 01/01/70 00:00 |