Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

C was not designed to create gui's. So its a feat of accomplishment as opening a bottle with your teeth.


IMHO it depends, C/C++ work very nicely with immediate mode UI frameworks, for example nuklear [1], imgui [2]. Though retained mode C/C++ UI frameworks are also quite popular, for example Qt, wxWidgets, GTK.

- [1] https://github.com/vurtun/nuklear

- [2] https://github.com/ocornut/imgui


Ummm... I wrote plenty of GUI code in C and so did lots of other people back in the late '80s and early '90s. Quite common. I don't know what it would mean for it to have been "designed to create" GUIs; it's a general-purpose language.


Windows, X11 and Gtk would argue with you.


There's Carbon as well, which was replaced by Cocoa. And as of 4 years ago (and I suspect today as well) there are still some things which you could only do in the Carbon's C APIs, so lots of CoreFoundation types which you can bridge directly from their objective C equivalents. Pretty neat stuff how well the backwards compatibility works.


Windows is written in C++ mostly.

As for X11 and Gtk, well, I argue with THEM.


Windows itself perhaps, but not the Windows API. If you've ever done any low-level Windows development, it's pure C.

See here for a tutorial using it for basic GUI stuff:

http://zetcode.com/gui/winapi/firststeps/

I've even seen several games that use it directly for keyboard handling and such to this day. And all the new, fancy GUI frameworks which exist on Windows are basically just wrappers on top of WinAPI.


Yes, but WinAPI (which is all that is required to do GUI programming in Windows) is C-centric.


Yeah, but nobody (ie. very few if anybody) does GUI programming in WinAPI, so I don't see how it's relevant in determining whether C is good for GUIs.


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.


"Going native" meant salvaging Vista's low performance by rewriting everything in C++ that was written in .NET -- .NET was the "wave" here, but it's also the culprit for Vista eating memory like cheap sushi.


Yet, the replacement of Win32 API model is with everything being written in the original design of .NET, with AOT native compilation and classes being COM objects.

What killed Vista was politics between OSDev and DevTools units.


Few languages have intrinsic GUI components.


I had a project once that required me to build a GUI in C using Motif. It was a joy to use. I recall there was a simple concept called RowColumn. All the GUI widgets were either in a Row or in a Column. It was highly orthogonal and allowed you to build good-looking UI's that acted in a reasonable way when resized, etc.


that analogy though




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: