What is extern volatile pointer

前端 未结 4 1431
别跟我提以往
别跟我提以往 2020-12-31 11:10

What is extern volatile pointer.

extern volatile uint32 *ptr;

Here, what will be the behavior of *ptr? What does this actually mean?

<
4条回答
  •  长发绾君心
    2020-12-31 11:17

    I would explain the way I know through the keywords. extern means the variable is defined for use somewhere outside the definition scope. For example it could be defined in header file and get used in .c file.

    volatile means that modification of that variable should be consistent to the external world. This means that all update should be committed to the main memory so that it can be seen by other threads which share the same execution space.

提交回复
热议问题