5 ms·
How to write an iOS app purely in C
- youngButEager 12y agoStackOverflow: CURATION BY HUMILIATION.
- pjbrunet 12y agoOne day, nobody will remember Objective-C. Let Apple have its 15 minutes of fame.
- zachlipton 12y agoAs someone recently noted in the discussion of Swift, Objective-C is basically older than the CD-ROM. I'd say the language has had several decades of life, not 15 minutes of fame. (Actually, it appears Objective-C is certainly older than the CD-ROM and is from about the same era as the audio CD.)
- pjbrunet 12y agoAnd the CDROM wasn't a blip in history between the Compact Cassette and now? BTW the CD-ROM is still way more popular than Objective-C. http://www.google.com/trends/explore#q=cd%20rom%2C%20objective-c&cmpt=q http://www.google.com/trends/explore#q=cd%20rom%2C%20objecti... But nice try anyway.
- pjbrunet 12y agoLooks like Objective C finally surpassed Fortran and Cobol somewhere in 2011. Good luck to you in the future ;-) http://www.google.com/trends/explore#q=%22objective%20C%22%2C%20fortran%2C%20cobol&cmpt=q http://www.google.com/trends/explore#q=%22objective%20C%22%2...
- jsmthrowaway 12y agoFunny thing, you saying "15 minutes," since Objective-C had existed for 15 years by the first time Apple used it. Eighteen years ago. As a multi-decade PHP developer, I would have guessed you'd be used to people deriding your language of choice and, based on that experience, developed enough common sense to not make a fool of yourself so publicly. I guess I expect too much of people.
- pjbrunet 12y agoI don't expect much wisdom from the youngsters here. If you were even able to read back then, nobody had heard of Objective-C until your idol Steve touched it with his golden finger. If you remember, Apple was a sad joke of a failure from the 80s till the iPod launched. And I'm sure Objective-C was really integral to the success of the Apple IIe and the iPod. Thanks for proving my point.
- deleted 12y ago[deleted]
- pikachu_is_cool 12y agoEven if your assumption Objective-C was only relevant after the release of iOS was correct, then Objective-C was still relevant since 2007. That's 7 years.
- pjbrunet 12y agoDo you think I literally meant 15 minutes? 7 years is nothing. Check this out. Objective-C wasn't even Apple's first choice. "Apple CEO Gil Amelio started negotiations to buy Be Inc., but negotiations stalled when Be CEO Jean-Louis Gassée wanted $200 million; Apple was unwilling to offer any more than $125 million. Apple's board of directors decided NeXTSTEP was a better choice and purchased NeXT in 1996 for $429 million, bringing back Apple co-founder Steve Jobs." https://en.wikipedia.org/wiki/BeOS https://en.wikipedia.org/wiki/BeOS So you're all using Objective-C because Apple couldn't afford to buy the OS they wanted. Kinda sad!
- pjbrunet 12y agoWow I lost 20 hitpoints (and falling rapidly) over this opinion. Did I touch a nerve? I can just imagine $AAPL shareholders quivering. "What is this guy talking about?" Betting it all on Objective-C, a unknown language based on a superseded language. Steve was so ballsy. Google at least had a clue. Java + Android actually makes sense.
- deleted 12y ago[deleted]
- pjbrunet 12y agoHow about you use your real name and explain why you dislike my opinion? It's a fact people would love to write apps for the iPhone in other languages. But that's not possible because Apple is a tyrannical company. Do you endorse this tyranny and do you believe it's sustainable? I don't believe it's sustainable and I believe history agrees with me, based on my 30 years of following programming languages. Who is the child now?
- pikachu_is_cool 12y agoJust want to point out that you're complaining about Apple being a tyrannical company, while at the same time you're praising Google for using Java.
- micampe 12y agoYour opinions are fine, but some of your facts are incorrect. http://xamarin.com http://xamarin.com http://www.rubymotion.com http://www.rubymotion.com http://www.appcelerator.com http://www.appcelerator.com http://unity3d.com http://unity3d.com http://developer.coronalabs.com http://developer.coronalabs.com
- richardjrossiii 12y agoAuthor of the answer in question here.. Feel free to ask me any questions you'd like about this! I also did the same thing in ARMv7 assembly, if you're interested in that: https://github.com/richardjrossiii/iOSAppInAssembly https://github.com/richardjrossiii/iOSAppInAssembly
- userbinator 12y agoReminds me of writing Win32 applications in C + Asm, although it looks even more difficult because the documentation is lacking and there's more stuff that has to be done. I find the fact that a simple, "do nothing" native iOS app is much bigger than some very featureful apps on other platforms somewhat sad... I don't know of any 64k/4k demos on iOS either. Great work for trying it though. Are all those bytes actually needed? E.g. I see a lot of "restore VFP/Advanced SIMD registers" when you don't seem to be using those at all. It would be interesting to see how much you can cut out, as currently it looks more like a mostly mechanical ObjC -> C -> Asm translation, like a compiler would do, instead of a human. As a point of reference, on Win32 an app that just shows a window with some text in it requires <1KB of binary.
- richardjrossiii 12y agoThe only reason I'm storing the VFP registers is because that is the 'official' iOS ABI, and yes, I could probably trim it down significantly, however, the binary itself currently sits at about 63k when compiled in debug mode, so I didn't deem it necessary to trim that further at that time. Some good ideas though, and one day I may just go ahead and do it!
- aninteger 12y agoWell done.. I'm curious about whether this would be possible in Android. I'm not talking about OpenGL and using the ndk but creating Android activities. Would it be much much more difficult?
- zachlipton 12y agoWell I suppose the Android equivalent would be writing raw Dalvik bytecode. Certainly possible, but probably not a lot of fun. It wouldn't be nearly as informative about the underlying architecture in any case.
- klodolph 12y agoThere's a category of questions on Stack Overflow like, > How do I do (complicated task X) without using (class of solutions Y)? It's like madlibs. I'll fill in the blanks for you: > How do I write a portable function for searching the filesystem in pure C++? Here, X is "search the filesystem portably" and Y is "just use Boost, dummy". > How do I create an iOS application without using Xcode? > How do I do AES encryption in my network code? (instead of just using a library to handle TLS) Programmers develop highly specialized taste as they mature, with preferences like "C is good, Java is bad" or "everything should be done with the command line" or "I never want to leave Visual Studio again". I'm amazed by how many people say, for example, that they absolutely can't use Boost but when pressed, they can't give a good reason why. That's because Boost offends their subjective sensibilities for some ill-understood reason, not because Boost is flawed in any particular way (although Boost certainly has its flaws). I have a ton of rep on Stack Overflow from answering questions, and so every time I answer a question like this, I remember all of the discussions I have had with people which go like this: > Me: (complicated task X) is a complicated task. It will take you weeks to do it by yourself. > Asker: But shouldn't it be easy? > Me: (reasons 1, 2, 3 why it's not easy) > Asker: But I don't care about 2 and 3, and I don't think 1 is a problem. > Me: (list of ways that things go horribly wrong if you do it yourself) If I may ask, why can't you use libraries? > Asker: I can't use libraries because (misconception about how libraries work). > Me: Oh, that's not true at all. The exchange takes place typically over the course of a couple hours, since Stack Overflow is not designed to allow a question to be used as chat. So sometimes, if I'm feeling like a show-off, I post some ridiculously complicated way of solving the question just as it was asked, then say at the bottom: > Or you can just do (easy solution Y), which is super easy, but you apparently can't do that for unspecified reasons.
- userbinator 12y agoThese are people who want to learn how something is actually done, to experience that sense of accomplishment themselves, and not just use a solution someone else has already written; and I don't think that's necessarily a bad thing.
- pjbrunet 12y ago
- pkulak 12y agoSometimes I start thinking I'm a really good programmer. These kinds of things are great for keeping me humble as hell.
- ygra 12y agoThe author of the accepted answer was 15 at the time of writing. At that age I had a good grasp of Turbo Pascal, but not much that would be of any use professionally.
- JoeAltmaier 12y agoAND there's a perfect example of the grief StackOverflow heaps upon both questioners and answerers. 80% of the comments were "you idiot, just use ObjC" or "ok that worked but you're an idiot for not using ObjC". Exactly one response to the correct answer bothered to read it or expand on it. Is all of StackOverflow overrun by smartasses? Or is it just the iOS crowd? What excuse can be given for all the unprofessional junk responses? How can they be suppressed? Moderators can be draconian but something is needed.