3 ms·
Interfaces which use the pattern: struct foo bar; foo_init(&bar); Can be very annoying in swift, it does play nicely with CoreFoundation which does not us
by fleitz 11y ago
Interfaces which use the pattern:
struct foo bar;
foo_init(&bar);
Can be very annoying in swift, it does play nicely with CoreFoundation which does not use this pattern
- mikeash 11y agoAs of Swift 1.something, C structs get imported with an empty initializer that sets everything to zero. So that pattern can be written in Swift as: var bar = foo() foo_init(&bar) No worse than the C version, as long as the unnecessary initialization is not a performance problem (which it usually isn't).