use the new &C.Foo(0) cast

pull/2973/head
Alexander Medvednikov 2019-12-04 12:19:32 +03:00
parent 2bafd41183
commit b2b34e18e4
3 changed files with 4 additions and 3 deletions

View File

@ -488,6 +488,7 @@ fn (p mut Parser) gen_struct_init(typ string, t Type) bool {
// TODO tmp hack for 0 pointers init
// &User{!} ==> 0
if p.tok == .not {
p.warn('use `$t.name(0)` instead of `&$t.name{!}`')
p.next()
p.gen('0')
p.check(.rcbr)

View File

@ -31,8 +31,8 @@ pub fn ls(path string) ?[]string {
if isnil(dir) {
return error('ls() couldnt open dir "$path"')
}
//mut ent := &C.dirent(0)
mut ent := &C.dirent{!}
mut ent := &C.dirent(0)
//mut ent := &C.dirent{!}
for {
ent = C.readdir(dir)
if isnil(ent) {

View File

@ -102,7 +102,7 @@ fn C.time(int) C.time_t
pub fn now() Time {
t := C.time(0)
mut now := &C.tm{!}
mut now := &C.tm(0)
now = C.localtime(&t)
return convert_ctime(now)
}