Explain the meaning of the next role.

Possible duplicate:
Strange use of emptiness

I read the C code and came across the following. Can someone explain what this does?

static int do_spawn(const char *filename)
{
  (void)filename;
  // todo: fill this in
  return -1;
}

In particular, what does the (void) filename do?

+5
source share
2 answers

Compilers sometimes complain about unused parameters; (void)"cast" is just a way to use a variable in the context of void, non-side-effect so that the compiler does not complain that it was "not used."

. Rodrigo, (void), ( , ). , (void)filename , .

+8

, .

+3

All Articles