Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Wouldn't -Wextra yell about the Badge being an unused parameter in the register devices? You would have to do some kind of dummy call that the compiler would have to optimize away.


If an argument is nameless, the compiler won't complain about it being unused.

No warning:

    void VFS::register_device(Badge<Device>, Device& device) { ... }
Warning:

    void VFS::register_device(Badge<Device> badge, Device& device) { ... }


There are attributes for that, standardized as of C++17 and available in most compilers much earlier. -Wextra won't yell about anything.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: