Hacker News new | ask | show | jobs
by pjmlp 4461 days ago
> he amazing thing is that you can potentially write all your code in C and have backend/frontend logic for the web, Windows, Windows Phone, OSX, FreeBSD, OpenBSD, Tru64, VAX, Arduino, Linux Kernel, Windows Kernel, Mach, Hurd, and practically every processor or operating system ever built, and even iOS/Android (via Xamarin). Wow.

Have you ever done C development like this, ever in your life?

I did. Between 1994 and 2003, we had applications run across Windows, HP-UX, Aix, DG/UX, GNU/Linux, BSD, Solaris.

An awful mess of #ifdefs, compiler specific behaviours, lack of POSIX compliance, OS specific extensions.

This on the server side, and lets not forget there are ZERO portable standards for writing portable GUI code in C.

Finally, C shouldn't never had become mainstream given its lack of safety, that we are still suffering in 2014. There were better systems programming languages in the late 70's, they just weren't at Bell Labs.

2 comments

The only portable GUI code that I've ever seen work somewhat reliably is HTML/CSS.

Everything else either implements a 3rd GUI, Swing, et al, or looks weird on a few of the platforms, GTK.

Oddly enough the best cross-platform lib I've seen, Qt, is written in C++.

C certainly isn't the be all and end all, however, it's far more portable, reusable, and linkable than C#.

From a platform perspective, Qt is good for all the desktop environments, but for mobile, .NET/Xamarin is the way to go.

From a language perspective, why in the world would you want GUI code in C or C++? Both languages make it very easy to shoot your foot off and have no idea what happened. However, C can be very elegant if used for the right reasons. C# is safer, but also not perfect. That's where F# comes in. :)

I actually had a super hard time with F# and XAML, this was back in F# 1.0/1.1 days.

While not strictly C, ObjC/UIKit is a helluva language for doing GUIs.

I actually don't like GUIs in C++/Java, or C# because it's far too restrictive and you spend all your time making the class hierarchy happy and typing boiler plate rather than getting stuff done.

ObjC is a beautiful mix of scriptyness and performance / low memory utilization. If ObjC is too slow, C is right there, and if it's too complicated for C add in a little C++. My typical mix is usually about 90-95% ObjC, 5-10% C, and 1% C++.

I love that if you know an object supports a method you can just cast to id and call it. If an object is missing a method, you just add it. If a base class is stupid, you override it.

Java/C# are total pieces of crap in this regard, although C# is far better for having extension methods.

Too bad you missed out on Flash / Flex. At one point it was absolutely brilliant.
Solution: Lua.