3 ms·
I'm pretty sure that's completely incorrect. Can you cite some source on this?
by sdegutis 13y ago
I'm pretty sure that's completely incorrect. Can you cite some source on this?
- pjmlp 13y agohttps://developer.apple.com/legacy/library/documentation/Cocoa/Conceptual/OOPandObjC1/OOPandObjC1.pdf https://developer.apple.com/legacy/library/documentation/Coc... Quote from appendix B, grammar: "This appendix presents a formal grammar for the Objective-C extensions to the C language—as the Objective-C language is implemented for the Cocoa development environment. It adds to the grammar for ANSI standard C found in Appendix A of The C Programming Language (second edition, 1988) by Brian W. Kernighan and Dennis M. Ritchie, published by Prentice Hall, and should be read in conjunction with that book" ANSI C grammar is a subset from Objective-C's grammar.
- sdegutis 13y agoRight, but you said it backwards, that C structs are really Objective-C types that look like C. This quote implies that C structs are simply C structs. This isn't just a pedantic point. You can't store an Objective-C pointer in a C struct, unless you cast it to a void* and bridge it. But then you're mixing ARC and non-ARC code in the same file, which is trickier to manage correctly.
- pjmlp 13y agoThe point I was trying to make is that altought the code looks like C, it is Objective-C code from the compiler design point of view. It is an Objective-C struct that shares the same semantics as a C struct. Similar to many other languages that have kept compatibility with C to easy code sharing between code bases.