|
|
Subscribe / Log in / New account

Catching the mismatch

Catching the mismatch

Posted Feb 11, 2025 11:20 UTC (Tue) by adobriyan (subscriber, #30858)
In reply to: Catching the mismatch by farnz
Parent article: Maintainer opinions on Rust-for-Linux

> warning: unused parameter '_' [-Wunused-parameter]

C compilers could (not warn) for underscored names while C programmers are waiting for C23.


to post comments

Catching the mismatch

Posted Feb 11, 2025 11:28 UTC (Tue) by farnz (subscriber, #17727) [Link] (1 responses)

I just checked, because I recalled that the Standard reserves names beginning with underscore; but that only applies to globally visible names, not local ones, so it'd be fine to use a name beginning underscore to suppress the warning.

Catching the mismatch

Posted Feb 13, 2025 5:26 UTC (Thu) by aaronmdjones (subscriber, #119973) [Link]

It's more complicated than that. The standard reserves names beginning with a single underscore only if the following character is an ASCII uppercase letter. A name beginning with an underscore followed by a lowercase letter is not reserved. If you want to guarantee a reserved name, it needs to begin with two underscores.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds