Could I ever want to access the address zero?

前端 未结 17 2998
花落未央
花落未央 2020-11-29 00:38

The constant 0 is used as the null pointer in C and C++. But as in the question \"Pointer to a specific fixed address\" there seems to be some possible use of assigning fixe

17条回答
  •  独厮守ぢ
    2020-11-29 01:06

    If I remember correctly, in an AVR microcontroller the register file is mapped into an address space of RAM and register R0 is at the address 0x00. It was clearly done in purpose and apparently Atmel thinks there are situations, when it's convenient to access address 0x00 instead of writing R0 explicitly.

    In the program memory, at the address 0x0000 there is a reset interrupt vector and again this address is clearly intended to be accessed when programming the chip.

提交回复
热议问题