Compiler optimization OFF for certain snippet of code in Visual code studio

Hi Team,

I know to change the compiler optimization of the project in menu config--> compiler settings.

Do we have any macro/configuration/option to enable/disable optimization for certain lines of code maintaing over all optimization settings for the rest of the code.

with regards,

Praveen Palaparthi

Parents Reply
  • Priyanka,

    We are using signal mechanisim in UART interrupt call back function. When we get signal from UART call back,  application will try to read data from ring buffer. As the data recevies continiously from UART with a delay maximum of 10msec, we implemented this logic, first iteration of do-while loop, reads data from ring buffer waits for 10msec and check for ringbuffer emply(head & tail are at same position) if ring buffer is empy comes out of this loop other wise reads the ring buffer again. During this process ringbuffer gives the number of bytes it read. With visual code studio its coming out of do while loop which means got number of bytes it read but printing as 0.

    Will try with volatile keyword and see the behaviour.

Children
Related