underscores

Why do the c libraries and language define _name and then typedef or pound define _name name?

你。 提交于 2020-06-26 04:14:21
问题 It seems that the C libraries and language has a lot of useless type names. For example, C has a built in type _Bool and there is a macro in stdbool.h , #define bool _Bool . Why didn't C just have bool built in instead of _Bool ? I found more examples in stdio.h and stdlib.h . Like this: # define WEXITSTATUS(status) __WEXITSTATUS (status) # define WTERMSIG(status) __WTERMSIG (status) # define WSTOPSIG(status) __WSTOPSIG (status) # define WIFEXITED(status) __WIFEXITED (status) # define

Why do the c libraries and language define _name and then typedef or pound define _name name?

时光总嘲笑我的痴心妄想 提交于 2020-06-26 04:14:14
问题 It seems that the C libraries and language has a lot of useless type names. For example, C has a built in type _Bool and there is a macro in stdbool.h , #define bool _Bool . Why didn't C just have bool built in instead of _Bool ? I found more examples in stdio.h and stdlib.h . Like this: # define WEXITSTATUS(status) __WEXITSTATUS (status) # define WTERMSIG(status) __WTERMSIG (status) # define WSTOPSIG(status) __WSTOPSIG (status) # define WIFEXITED(status) __WIFEXITED (status) # define

Why is a single underscore character an illegal name for a lambda parameter?

Deadly 提交于 2019-12-21 03:17:06
问题 I tried naming a lambda parameter _ , e.g. (a cut down version): Consumer<Object> c = _ -> {}; as I wanted to signify that a parameter was being ignored, but I got the following compiler error: use of '_' as an identifier is forbidden for lambda parameters This was a surprise for me. Interestingly, two underscores is OK: Consumer<Object> c = __ -> {}; // no compile error So it's not the underscore character in general, but a single one. Why is the single-underscore name specifically forbidden

What means “_” symbol in Kotlin?

北战南征 提交于 2019-12-02 13:03:19
问题 I tried to find information what it means but I didn't. Trying to understand what it does in this code: checkBox.setOnCheckedChangeListener { _, isChecked -> if (isChecked) { // The toggle is enabled } else { // The toggle is disabled } } 回答1: The _ Used for substitutes an unused parameter in a lambda expression substitutes an unused parameter in a destructuring declaration For more information check this Keywords and Operators 来源: https://stackoverflow.com/questions/59006347/what-means

What does an underscore and interface name after keyword var mean?

一世执手 提交于 2019-11-26 00:48:58
问题 From http://golang.org/src/pkg/database/sql/driver/types.go: type ValueConverter interface { // ConvertValue converts a value to a driver Value. ConvertValue(v interface{}) (Value, error) } var Bool boolType type boolType struct{} var _ ValueConverter = boolType{} // line 58 func (boolType) String() string { return \"Bool\" } func (boolType) ConvertValue(src interface{}) (Value, error) {....} I known that ValueConverter is an interface name. Line 58 seems to declare that boolType implement

What does an underscore and interface name after keyword var mean?

你离开我真会死。 提交于 2019-11-25 19:25:16
From http://golang.org/src/pkg/database/sql/driver/types.go : type ValueConverter interface { // ConvertValue converts a value to a driver Value. ConvertValue(v interface{}) (Value, error) } var Bool boolType type boolType struct{} var _ ValueConverter = boolType{} // line 58 func (boolType) String() string { return "Bool" } func (boolType) ConvertValue(src interface{}) (Value, error) {....} I known that ValueConverter is an interface name. Line 58 seems to declare that boolType implement interface ValueConverter, but is that necessary? I deleted line 58 and the code works well. It provides a