Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what does the following call mean in C? [duplicate]

Tags:

c

cortex-m

I am exploring an sdk and I came across the following set of statements.

uint32_t init_time = 0;
init_time = get_current_time_in_ms();
(void)init_time; // What does this statement do?

My first thought was that this is a NULL check of some sorts but I tried zero and non-zero value in a test C code doing something similar but response in both case was the same.

Any help would be appreciated.

like image 897
yashC Avatar asked Dec 22 '22 22:12

yashC


1 Answers

This statement does not do anything logically.

It is sometimes added to avoid warnings in compilers and Static Analysers for unused variables

like image 71
Rishikesh Raje Avatar answered Jan 02 '23 12:01

Rishikesh Raje