3 ms·
Hi, The ISO C standard in section 7.1.3 states that global functions and variables in compiler/system libraries should be prefixed with an underscore to avoid
by Randor 6y ago
Hi,
The ISO C standard in section 7.1.3 states that global functions and variables in compiler/system libraries should be prefixed with an underscore to avoid the risk of conflict with names in user programs.
I checked and indeed... lg_buf is a global variable.
But I've never seen anyone use just the underscore prefix without a name before.
- chrisseaton 6y ago> I checked and indeed... lg_buf is a global variable. struct lg_buf is a type, not any kind of variable. And here _ is a local variable, not a global variable so can't conflict with anything else anyway. So what you've said doesn't apply for more than one reason.
- Randor 6y agoThanks, In that case I don't really know why the guy named his variable with an underscore.
- codr7 6y agoBecause it's short, easy to recognize and somewhat accepted to signify that the name doesn't matter and even 'it' in Perl. I find that using it for the default parameter (or self) simplifies the code substantially on a visual level.