Hacker News new | past | comments | ask | show | jobs | submit login

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.




Registration is open for Startup School 2019. Classes start July 22nd.

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

Search: