objective c - Can Object C compile to C? -
can compile objective c program c?
i'm interested if can done can compiled other c compilers.
i aware gcc can compile objective c.
sure. example, poc compiles objective c plain c code, , recommended way use compile c code gcc.
of course generated c unreadable mess, consisting of calls (through generated extern declarations) objc_runtime calls, you'll need link runtime compiled code.
there's llvm backend generates c code frontend. so, can plug in clang objective c frontend , c backend , build own objc-to-c compiler. result more unreadable poc generates.
of course people don't want compile objective c*, want compile "objective c 4.0".** poc won't that; clang , llvm-gcc (and in future, clang). , don't want objective c runtime, want os x or ios runtime, or @ least openstep, again pretty means clang, llvm-gcc, or gcc.
the big question is, why want this? need have objective c runtime link to, , c code have compiled in way that's abi-compatible way runtime compiled, so… i'm not sure you're going gain on compiling objc native code gcc or clang in first place.
* in language defined in brad cox's 1986 book and/or in 1991 followup.
** note apple explicitly decided not call latest revisions language "objective-c 4.0"… or else. last version name, or real specification, "the objective-c 2.0 programming language". apple has continued add features, , "unnamed feature set came in llvm 4.0 frontend objective-c 2.0" bit of mouthful.
Comments
Post a Comment