Live data from Hacker News

OS X app in plain C

github.com

131–140 of 157 posts

Re: OS X app in plain C

#131
post #26

Earlier quoted context omitted.

Windows is written in C++ mostly. As for X11 and Gtk, well, I argue with THEM.

Unless something has changed drastically since when I was at MS, the Windows kernel and the major OS DLLs is pretty much pure C. The GUI/window manager are more C++. Even Word and Excel were still C (although Office shared much C++ code in a common DLL) Gotta love legacy code from the 1980s/1990s.

When were you there?

Since the new "Going native" wave, C++ has taken the role of main systems programming language, even the DDK now supports it.

Regarding office check their CppCon presentation how the code was ported to C++, refactored and made portable across OS. About 2h session.

Re: OS X app in plain C

#132
post #98
post #5

There was a thread the other day where people were talking about languages that were easily interoperable with the "C ABI" (although there is no such thing). Languages listed included C++, Rust, and maybe a few others--but no mention of Objective-C. The ability to use a high-level, dynamic language (ObjC), C, and even inline assembly in a single source file is unique to Objective-C (at least among the "mainstream" la…

not really. MS have had this with their C++ for a very long time... easily 20 years +

Unless MS has a custom C++ runtime that I'm not aware of, I wouldn't consider C++ a high level language like obj-c is, for better or worse. The benefits and drawbacks of runtime dispatch are highly debatable, but the amount of runtime metaprogramming you can do in ObjC is comparable to what you can do in a language like Ruby:

* Call any method (send message in objc parlance) based on the string name of the method * Add methods to existing classes you don't own * Swap existing method implementations of a class you do not own at runtime (method swizzling) * Get and set variables by their string name for subclasses of NSObject * Check if an object has a method with a given name (great for invoking methods conditionally)

http://genius.com/Soroush-khanlou-objective-c-isnt-what-you-...

Re: OS X app in plain C

#133

Earlier quoted context omitted.

I don't know who you've been talking to, but that's ridiculous. C++ is one of the most widely-used languages for writing native apps for any OS. Adobe products, Chrome, anything built with Qt, even the Swift language itself, all made in C++.

Most apple platform apps are written in mostly objc or Swift and not C++, I wouldn’t say it is one of the most widely used languages on these platforms by any means. The Cocoa SDK exposes an objc interface so many system framework calls have to use swift or objc. Secondly, compilers are a very different programming task to developing GUI apps; the Swift team choosing to use it has nothing to do with Apple’s assessmen…

Perhaps most smaller apps, yes. And some big ones too. But a very significant percentage of the commercial software industry writes apps for OSX in C++, including Autodesk, Adobe, many major games written using engines like Unreal and Unity (which also support other languages), etc.

That's not a knock against anyone who does or doesn't write apps in a particular language; but folks should know what the reality is, and Objective C or Swift are by no means the only or even necessarily the most profitable ways to writes apps for OSX, though those languages are perfectly fine for many circumstances.

Re: OS X app in plain C

#134

Earlier quoted context omitted.

you mean objective-c++? c++ has no idea about obj-c... another thing most people forget is that the entire programming community rejected obj-c as deficient in its very early days... it only persists thanks to the ego of former nextstep employees afaik. and now apple employees got lumped with it... which i'd suspect helped create the internal pressure for swift... so some good came at the end of it all. :)

Objective-C was the major inspiration for Java - you'll notice how little it looks like C++ - and therefore C# and co, so it's been very influential ever since the 90s. It's not worth listening to anyone who dislikes Obj-C just because of the [] syntax, which doesn't matter after the first 48 hours.

> It's not worth listening to anyone who dislikes Obj-C just because of the [] syntax, which doesn't matter after the first 48 hours.

That's pretty much my thoughts these days. If you have only the most superficial understanding of these languages, then that's what you'll get caught up on, but that's like saying Java and JavaScript are similar because they both use curly braces and dot notation for their methods. Yea, that is true, but it's a superficial similarity.

Re: OS X app in plain C

#135

> For some reason if we run the app from command line than menu is not accesible by mouse at first time This happens with Qt apps on OS X, as well, and it drives me bonkers. If you launch from the command line you have to command tab away and back for the menu to work

Strangely this happens on my cocoa app too... but it hasn't always been the case and I've had this thing for about 5 years now, so I suspect that somewhere, something got messed up.

Re: OS X app in plain C

#136

Earlier quoted context omitted.

What, like C as a shell script? Gott in Himmel!

How about an interactive C++ interpreter: https://root.cern.ch/cling Also it's Gott im Himmel ;-) (unless it's a reference I didn't get)

iPhone autocorrect :-(

Re: OS X app in plain C

#137
post #5

There was a thread the other day where people were talking about languages that were easily interoperable with the "C ABI" (although there is no such thing). Languages listed included C++, Rust, and maybe a few others--but no mention of Objective-C. The ability to use a high-level, dynamic language (ObjC), C, and even inline assembly in a single source file is unique to Objective-C (at least among the "mainstream" la…

I'm going to miss Objective C terribly. It is, hands down, still my favorite language (and ecosystem). It's interoperability with C got me into C. It was insanely powerful and fun. I know not many people agree with me. I liked the square braces and crazy long function names. I know Swift is decent... It's not the same. Oh well. Lamenting my path to software engineering doesn't mean much for anyone else. But I really…

I feel the exact same way about it but hopefully it isn't going to go anywhere any time soon.

WWDC 2016 will hopefully have some nice objective C announcements just like last years did.

Re: OS X app in plain C

#138

Don't do this at home. It looks so ugly because it's dangerous and vice-versa. If you really want to write (and read) code like this: id titleString = ((id ( )(id, SEL, const char ))objc_msgSend)((id)objc_getClass("NSString"), sel_registerName("stringWithUTF8String:"), "sup from C"); ((void (*)(id, SEL, id))objc_msgSend)(window, sel_registerName("setTitle:"), titleString); instead of this [window setTitle:@"sup"]; th…

There are Objective-C to C converters.

http://users.telenet.be/stes/compiler.html

However, the dialect this one implements is very different from Apple's, and it doesn't quite produce ANSI C (the generated code does some things which you can usually get away with but are technically illegal, like casting object pointers to function pointers). It's mainly of historical interest now.

Re: OS X app in plain C

#139

Earlier quoted context omitted.

> The ability to use a high-level, dynamic language (ObjC), C, and even inline assembly in a single source file is unique to Objective-C (at least among the "mainstream" languages), and something I think is often under-appreciated. You can even use C++, too, which is awesome. Putting Objective-C objects in C++ structs "just works" thanks to ARC. One thing most people don't know is that Objective-C was originally impl…

you mean objective-c++? c++ has no idea about obj-c... another thing most people forget is that the entire programming community rejected obj-c as deficient in its very early days... it only persists thanks to the ego of former nextstep employees afaik. and now apple employees got lumped with it... which i'd suspect helped create the internal pressure for swift... so some good came at the end of it all. :)

Objective-C is what makes developping applications on iOS so much more efficient than on Android; even if only indirectly, thru the frameworks provided: if Android cannot provide frameworks usable more efficiently than Apple, it's because they're using Java instead of Objective-C.

https://infinum.co/the-capsized-eight/articles/android-devel...

Re: OS X app in plain C

#140
post #5

There was a thread the other day where people were talking about languages that were easily interoperable with the "C ABI" (although there is no such thing). Languages listed included C++, Rust, and maybe a few others--but no mention of Objective-C. The ability to use a high-level, dynamic language (ObjC), C, and even inline assembly in a single source file is unique to Objective-C (at least among the "mainstream" la…

I'm going to miss Objective C terribly. It is, hands down, still my favorite language (and ecosystem). It's interoperability with C got me into C. It was insanely powerful and fun. I know not many people agree with me. I liked the square braces and crazy long function names. I know Swift is decent... It's not the same. Oh well. Lamenting my path to software engineering doesn't mean much for anyone else. But I really…

Why miss it? Just go on using it! If important applications are written in Objective-C, that will motivate the spreading of Objective-C.
Post reply on HN