Thursday 15 May 2014

c - Creating a struct from mach_timebase_info() -



c - Creating a struct from mach_timebase_info() -

creating time base of operations info struct in c easy, in swift next not work in playground:

let timebaseinfo: mach_timebase_info_data_t = mach_timebase_info(&timebaseinfo)

the error variable used within own initial value

i understand error, unable think of way without dropping downwards c. there swift way missing? help appreciated. :-)

edit: see "a" problem above, "=" doesn't create sense. did seek next also:

let timebaseinfo: mach_timebase_info_data_t mach_timebase_info(&timebaseinfo)'

with error stating timebasedinfo used before initialization. :-(

you'll need utilize unsafemutablepointer<type>, follows:

let p = unsafemutablepointer<mach_timebase_info_data_t>.alloc(1) mach_timebase_info(&p.memory)

c swift

No comments:

Post a Comment