prevent gcc from removing an unused variable

前端 未结 5 968
不思量自难忘°
不思量自难忘° 2020-12-16 12:27

In our source files we usually have a version string like that:

static const char srcvers[] = \"VERSION/foo.c/1.01/09.0         


        
5条回答
  •  北荒
    北荒 (楼主)
    2020-12-16 13:03

    Declaring the variable as volatile can also help. That's why it is used in the first place, preventing any optimizations by the compiler regarding that variable.

提交回复
热议问题