How to write an iOS app purely in C
stackoverflow.com
stackoverflow.com
I also did the same thing in ARMv7 assembly, if you're interested in that:
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.
Some good ideas though, and one day I may just go ahead and do it!
I'm not really sure what you mean. Any program for Android which is 100% C code is going to be using the NDK in most cases. Including ones creating an activity natively ( http://developer.android.com/reference/android/app/NativeAct... ).
Seemly what it do is compile a valid ARM code using arm abi (not even the linux abi), and then there is a component that do use android OS stuff to load in the memory the code you compiled for arm abi...
Funky stuff. And patended. (Marmalade website make VERY CLEAR that their "Secret sauce" is their loaders, that are also very much patended...)
> 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.
While this is true sometimes, many times it is simply that they don't want to learn a new way to do something. You can tell which side of the fence they lean towards in the way they phrase the question.
It sounds like you're arguing against learning. When you're a beginner, one of the most frustrating things is when people won't answer your questions due to an air of superiority. I know you feel like you're guiding people onto the best path, but it can't be true that you're correct in every case. So it must be true that at least some of the time you're being deliberately evasive for incorrect reasons. In other words, you believe you're being helpful, but you're not.
Answer their question, choose not to answer, suggest an alternate way of doing something, but please don't go on for hours about why their original plan is a bad idea. It's often the quickest way to kill the fun and their will to learn.
I've personally have wrestled with this, and many times its a case where its most certainly a premature optimization. There are times where I've bent over backwards to avoid calling a `new` inside a Java loop because of some project, some years ago, was running slowly and when I profiled it came down to too many allocations in a loop. I try to hammer "benchmark & profile" in may head however.
In general, Boost is just a huge library. Using it may make your code unfamiliar to people who don't know the whole huge library, because there is a strong temptation to start using random parts of the library. Additionally, the style of Boost doesn't always mesh well with the coding style you are using. This is why Google, for example, bans boost except for a small number of approved functions.
When I'm on Stack Overflow, I always end up downvoting a lot of answers that don't answer the question being asked. "You are dumb for wanting to know the answer to this question," no matter how politely it's phrased, is not an answer.
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.
At that age I had a good grasp of Turbo Pascal, but not much that would be of any use professionally.
These kinds of things are great for keeping me humble as hell.
Let Apple have its 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.)
http://www.google.com/trends/explore#q=cd%20rom%2C%20objecti...
But nice try anyway.
http://www.google.com/trends/explore#q=%22objective%20C%22%2...
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.
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.
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
So you're all using Objective-C because Apple couldn't afford to buy the OS they wanted. Kinda sad!
In the early Mac OS X days, developers could choose between Objective-C and Java as the Mac OS X main language, the majority went for Objective-C and the JavaBridge was dropped.
In particular: Objective-C was created in 1983 and its first big success was when NeXT decided to adopt it as its main language for the NeXTstep operating system in 1988. And guess who was CEO of NeXT? That's right, none other than "your idol Steve".
So unless you're saying that nobody had heard of Objective-C until 1988, which is a pretty reasonable timeframe for a language invented in 1983, you're way off base.
"The NeXT Computer was not a great commercial success" https://en.wikipedia.org/wiki/NeXT_Computer
http://en.m.wikipedia.org/wiki/File:First_Web_Server.jpg
Disclaimer: I am younger than any technology mentioned in this thread.
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.