mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
all: make 0 => unsafe { nil } an error, not a notice
This commit is contained in:
parent
a2d385aee3
commit
2b52153c14
15 changed files with 26 additions and 33 deletions
|
@ -6707,16 +6707,16 @@ struct Node {
|
|||
}
|
||||
|
||||
// Reference fields must be initialized unless an initial value is declared.
|
||||
// Zero (0) is OK but use with caution, it's a nil pointer.
|
||||
// Nil is OK but use with caution, it's a nil pointer.
|
||||
foo := Node{
|
||||
a: 0
|
||||
a: unsafe { nil }
|
||||
}
|
||||
bar := Node{
|
||||
a: &foo
|
||||
}
|
||||
baz := Node{
|
||||
a: 0
|
||||
b: 0
|
||||
a: unsafe { nil }
|
||||
b: unsafe { nil }
|
||||
}
|
||||
qux := Node{
|
||||
a: &foo
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue