Initial Impression

1 view
Skip to first unread message

muni

unread,
Mar 13, 2008, 3:17:44 PM3/13/08
to iPhoneOSCoders
Folks,

I am loving the ANSI C support on the Iphone. My initial impression is
that of amazement. Most mobile handhelds and embedded devices have a
watered down support of ANSI C. The Iphone amazes me that it can
support dynamic file reads which is perfect if you don't want to store
huge data structures in memory.

The obj-c is a pain which I can't seem to get away from as all the UI
requires its use. Getting used to it though.

Any cocoa, iphone UI designer/developers in the dallas/fort worth
area ?

Muni Bajpai
http://www.kannuu.com
Stop Searching, Start Finding.

Cesar Alaniz

unread,
Mar 14, 2008, 10:24:42 PM3/14/08
to iPhoneOSCoders
One right here! I'm sure there is huge interest in development in the
Dallas/Ft. Worth region. Would be nice to meet everyone.

Cesar
> Muni Bajpaihttp://www.kannuu.com
> Stop Searching, Start Finding.

muni

unread,
Mar 15, 2008, 12:20:40 PM3/15/08
to iPhoneOSCoders
You know, I haven't met that many people developing for the iphone
here in DFW. There was the conference in austin last week but nothing
commercially explosive seems to be on the horizon. Would love to meet
more folks too. I have some ideas with this revolutionary new lookup
technology that I have ported to the aspen platform and now want a UI
around it.

ryanspahn

unread,
Mar 22, 2008, 2:31:59 PM3/22/08
to iPhoneOSCoders
Do either of you guys do freelance work?

I need an iPhone port of my Windows Mobile app for my startup (
http://Sleep.FM ). Windows Mobile app has been created in C++ which I
heard is not too complicated to port it to Objective-C.

Cheers,
Ryan

muni

unread,
Mar 23, 2008, 11:23:21 AM3/23/08
to iPhoneOSCoders
ryan,

I am not a freelancer and am very busy at the moment porting my own UI
toolkit to the aspen platform.

Just as feedback .. Objective-C is a superset of ANSI/ISO C, not C++.
Specially not MFC. If your application was written in C then the port
would be trivial. C++ classes are not compatible on objective C as
much as I can tell.

I think your best bet would be to buy a mac mini, buy a good book on
cocoa development and rewrite the application in layers with the base
layer being ANSI C so it is completely portable on both platforms.
The additional UI layer would plug into the base and be different on
both the windows mobile and iphone platforms.

- Muni

On Mar 22, 1:31 pm, ryanspahn <ryansp...@gmail.com> wrote:
> Do either of you guys do freelance work?
>
> I need an iPhone port of my Windows Mobile app for my startup (http://Sleep.FM). Windows Mobile app has been created in C++ which I

Michael Rutman

unread,
Mar 23, 2008, 9:38:47 PM3/23/08
to iphoneo...@googlegroups.com

On Mar 23, 2008, at 11:23 AM, muni wrote:

>
> Just as feedback .. Objective-C is a superset of ANSI/ISO C, not C++.
> Specially not MFC. If your application was written in C then the port
> would be trivial. C++ classes are not compatible on objective C as
> much as I can tell.
>

Name your source files ending with .mm or .M and you can use C++.

There is not binding from C++ to Objective-C methods but you could add
them if you really want.


muni

unread,
Mar 24, 2008, 1:55:10 PM3/24/08
to iPhoneOSCoders
Its not a question of forcing C++ usage. The bottom line as far as I
can tell is that you cannot intermingle objects from objective-c and c+
+. You can have a cocoa application written purely in C++ but you
cannot have both C++ and Objective-C in the same App. The idea is to
desist the usage of C++ and use only Objective-C + ANSI C.

Michael Rutman

unread,
Mar 24, 2008, 2:08:09 PM3/24/08
to iphoneo...@googlegroups.com

I think you should double check as I mix ObjC and C++ objects all the
time.

You can call C++ and Obj-C methods from each other if you know what
you are doing. The only issue is the syntax is ugly without writing
your own bindings.

As far as cocoa development, though not the iPhone, you can even
intermix Ruby and Python objects, including subclassing an Obj-C
object with a Ruby object and visa versa.

If you write the C++ binding then you could subclass an Obj-C object
with a C++ object.

iPhone has no Ruby or Python support so you can't do that on the iPhone.

Justin Anderson

unread,
Mar 24, 2008, 3:02:51 PM3/24/08
to iphoneo...@googlegroups.com
It's not pretty, but it's certainly doable.

http://en.wikipedia.org/wiki/Objective-C#Objective-C.2B.2B

On Mar 24, 2008, at 1:55 PM, muni wrote:
>

muni

unread,
Mar 24, 2008, 5:03:56 PM3/24/08
to iPhoneOSCoders
Folks,

This is from the wiki page

* A C++ class cannot derive from an Objective-C class and vice
versa.
* C++ namespaces cannot be declared inside an Objective-C
declaration.
* Objective-C classes cannot have instance variables of C++
classes which do not have a default constructor or which have one or
more virtual methods, but pointers to C++ objects can be used as
instance variables without restriction (allocate them with new in the -
init method).
* C++ "by value" semantics cannot be applied to Objective-C
objects, which are only accessible through pointers.
* An Objective-C declaration cannot be within a C++ template
declaration and vice versa. Objective-C types, (e.g., Classname *) can
be used as C++ template parameters, however.
* Objective-C and C++ exception handling is distinct; the handlers
of each cannot handle exceptions of the other type.
* Care must be taken since the destructor calling conventions of
Objective-C and C++'s exception run-time models do not match (i.e., a C
++ destructor will not be called when an Objective-C exception exits
the C++ object's scope).

So in essence you cannot use the "Object Orientation" of C++ in
Objective-C. Now you can always write functional code in C++ and call
yourself a C++ application but with an application that relies heavily
on inheritance and interfaces which most well written C++ applications
do, you will be hacking incessantly to make this work.

My 2 cents.

Michael Rutman

unread,
Mar 24, 2008, 5:34:33 PM3/24/08
to iphoneo...@googlegroups.com

Mani,

I'm sure you are very ernest, but you are really starting to stretch a
point.

For example, I can easily do the following:

std::map<std::string, NSObject *> myMaps;

You can also write code like this:

class MyCObject
{
public:
MyCObject() { myObjCObject = [[NSObject alloc] init]; }
private:
NSObject *myObjCObject;
};

And you can do the following:

@interface MyObjcObject : NSObject {
std::string m_CPPString;
}

@end

Now, I want to clarify, there are things you cannot do, and some would
say that you don't have 100%. However, your original point was that
you couldn't do anything at all. If I may quote you:

>>> and c+
>>> +. You can have a cocoa application written purely in C++ but you
>>> cannot have both C++ and Objective-C in the same App. The idea is to
>>> desist the usage of C++ and use only Objective-C + ANSI C.
>

I do notice that your latest comment is a lot less, shall we say,
strident.

muni

unread,
Mar 25, 2008, 8:49:38 AM3/25/08
to iPhoneOSCoders
Mikhail,

My point her is something that you are pointing out yourself. C++ and
Objective-C are NOT designed to be mixed. You are allocating Maps with
NSObjects and creating Obj-C interfaces but you are not doing anything
Object oriented like sub classing, interfacing, polymorphism etc. If
you are not doing anything object oriented then give yourself a
clarity of thought and redesign your application in ANSI C, and not
half baked C++ for the sake of being called object oriented.

You can hack and do what you want but that goes against design
principles and just promotes bad code. My personal preference is to
have clean design and good code.

Having said that, Enough said on this topic. You are free to do what
you want anyways, but please don't promote hacks and bad designs.

David Waite

unread,
Mar 26, 2008, 12:17:24 PM3/26/08
to iPhoneOSCoders
There are plenty of reasons to mix C++ and Objective C code. Not all
applications are written from the ground up to be Macintosh/iPhone
only - Objective C is first and foremost a language for GUI, and has
features (like Objective-C++) to make it easier for people who have a
MVC architecture to make their View layer Objective-C - keeping their
model and controller layers cross-platform.

-David Waite
Reply all
Reply to author
Forward
0 new messages