(void) variable
might work for some compilers.
For C++ code, also see Mailbag: Shutting up compiler warnings where Herb Sutter recommends using:
template<class T> void ignore( const T& ) { }
...
ignore(variable);
Related Contents:
- Why is “while( !feof(file) )” always wrong?
- How does free know how much to free?
- Why does a function with no parameters (compared to the actual function definition) compile?
- Why is the asterisk before the variable name, rather than after the type?
- Do I need to explicitly handle negative numbers or zero when summing squared digits?
- What do the parentheses around a function name mean?
- How can I convert a file pointer ( FILE* fp ) to a file descriptor (int fd)?
- DESTDIR and PREFIX of make
- What do numbers using 0x notation mean?
- ~x + ~y == ~(x + y) is always false?
- How do I make an infinite empty loop that won’t be optimized away?
- Are parallel calls to send/recv on the same socket valid?
- How to declare a structure in a header that is to be used by multiple files in c?
- How to list files in a directory in a C program?
- Difference between static memory allocation and dynamic memory allocation
- How are C data types “supported directly by most computers”?
- What’s the difference between hard and soft floating point numbers?
- Why is printf with a single argument (without conversion specifiers) deprecated?
- What is the time complexity of my function? [duplicate]
- How do I check if a variable is of a certain type (compare two types) in C?
- #ifdef inside #define
- Function pointers, Closures, and Lambda
- Undefined reference to sqrt (or other mathematical functions)
- Why is the compiler throwing this warning: “missing initializer”? Isn’t the structure initialized?
- How to build a release version binary in Go?
- What’s the use of suffix `f` on float value
- Variable declaration in a header file [duplicate]
- C How to “draw” a Binary Tree to the console [closed]
- What is the purpose of “;” at the end of for loop?
- How to compile executable for Windows with GCC with Linux Subsystem?
- Going through a text file line by line in C
- How to share memory between processes created by fork()?
- Convert a Static Library to a Shared Library?
- How do I share variables between different .c files? [duplicate]
- How can I clear an input buffer in C?
- What is the fastest way to find if a number is even or odd?
- Will a `char` always-always-always have 8 bits?
- Is the sizeof(enum) == sizeof(int), always?
- What does the first “c” stand for in “calloc”?
- Can I display the value of an enum with printf()?
- Function pointers and address of a function
- What does it mean to write to stdout in C?
- Passing multidimensional arrays as function arguments in C
- Dereferencing a pointer to 0 in C
- C complex number and printf
- Difference between LPVOID and void*
- How do I read a string entered by the user in C?
- Struct assignment or memcpy? [duplicate]
- C header files and compilation/linking
- Why is this valid C