Strictly speaking that line directs the compiler to read the current value of
tblname and then to throw the value away. The compiler may well optimize out this access to
tblname.
Behavior is similar in the following code snippet, but the purpose is different.
- void function(volatile char *p) {
-
(void) *p;
-
}
In this case, the value at the location referenced by
p is read and then discarded. However, the
volatile keyword prevents this access from being optimized out. There are real situations where a memory-mapped I/O port needs to be read from, but the value you get out of it is irrelevant.