1

I'm looking at the FUSE hello world example, and I'm seeing a really strange construct. Here's the excerpt that confuses me:

static int hello_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
             off_t offset, struct fuse_file_info *fi)
{
    (void) offset;
    (void) fi;

    if (strcmp(path, "/") != 0)
        return -ENOENT;

    filler(buf, ".", NULL, 0);
    filler(buf, "..", NULL, 0);
    filler(buf, hello_path + 1, NULL, 0);

    return 0;
}

As you can see, the first thing being done in this function is (void) offset; and (void) fi;. What does that accomplish, exactly?

Alex
  • 3,429
  • 4
  • 36
  • 66
  • 6
    It is/was a common technique to ward off "unused variable" warnings coming from lint or the compiler. See also: [casting unused return values to void](http://stackoverflow.com/questions/689677/casting-unused-return-values-to-void) – Jeff Mercado Jul 13 '14 at 07:55

0 Answers0