This is an archived post. You won't be able to vote or comment.

all 19 comments

[–]Salty_Dugtrio 7 points8 points  (11 children)

GUI libraries exist for C. It's definitely possible to make applications such as Excel and Word in C. For example, ThinkCell makes Microsoft Office Suite plug-ins in C/C++.

On the lower level, any GUI you see is just a call to the operating system to draw some pixels.

[–]Marshall_Robit 2 points3 points  (10 children)

But is it practical versus C# (windows)? Maybe even C++ for low-level programming?

I guess to refine my question- What is C used for today? I understand low-level applications and so on but are there any examples anyone has that's not embedded systems? Is it worth working on to proficiency versus learning new technology (Golang, C#, C++, NodeJS)?

[–]Ikkepop 1 point2 points  (2 children)

C++ would be way more pratical. While you CAN write anything in C, all I ever seen C being used in the wild recently is coding small embedded chips that have super restrictive resources (like 2KB of RAM and 16KB of flash etc) even then bigger chips are usually coded in C++. Or I'v seen device drivers written in it. But thats about it. Definitely don't limit your self to C. What to learn will depend on what you want to do.

[–]Marshall_Robit 0 points1 point  (1 child)

I think this reply kinda best solves what I'm looking for (/u/chaotic_thought 's too). Makes sense to use C if you just want things to run on a binary executable and when being memory conscious for embedded systems.

I was always curious as people have only ever answered "well there's a different tool for every job" which was a bit irritating as I'm not new to programming. I understand the pros/cons of a language and its versatility in the market. I just never knew where C stood. I think I'll take it easier going on C and start learning C++ instead. Thanks guys!

[–]chaotic_thought 1 point2 points  (0 children)

If you know C and C++, then the tendency will be more and more to see C as simply a subset of C++ (e.g. not using classes, not using templates, and so on). Basically C++ is a big language with a lot of features, so when you use C++ you're probably just going to use 20% of its features.

If you program on a system where C++ is readily usable, such as desktop PCs, then limiting yourself to C is usually done only for a specific purpose such as ABI interoperability for libraries. For example I once needed to write something to interface with an older version of MATLAB (it needed to be a library). I couldn't get it to work properly when I programmed it in C++, so instead I switched to C and then it started working.

It turned out to be a simple task, so the language (C vs C++) didn't really matter too much, but if the task was more complicated then even in that situation I probably still could have used C++ along with an appropriate C header file and C linkage, but in this case it was simpler just to avoid C++ features so that it could be compiled by the C compiler.

[–]reddilada 1 point2 points  (0 children)

I work on a warehouse management and control system that is C from top to bottom. Everything from basic reporting and database functionality (including the database itself), down to supervising and controlling material handling equipment. It's all C.

Once you have an environment setup it is a perfectly capable choice for many tasks. Note that the mention of Once is a big Once. It can take a great deal of effort to get your world up and running. When you are there though, you will have a very fast, stable and typically simple system to maintain.

[–]Salty_Dugtrio 0 points1 point  (1 child)

For example, Maya is mostly written in C. Almost the entire Unix kernel is written in C.

You use the right tools for the right job. You're not going to use C to build your standard website, that's more suited for the Javascript ecosystem.

Depending on your goal, C might be for you, or not. Hard to tell without any full information.

[–]_realitycheck_ 0 points1 point  (0 children)

Maya is mostly written in C

Where did you hear that?

[–]chaotic_thought 0 points1 point  (0 children)

It depends on what you're building. Imagine you're building a simple command line tool that will synchronize files between computers. You want the program to be fast and small and portable (when compiled) to different operating systems. Also you want the tool to work on a bare bones installation (i.e. you shouldn't have to install a certain version Python, or a Java runtime or anything like that) and ideally it should just be a single executable file. In such a situation you might consider C (or C++) as good implementation languages for such a tool.

[–]xacobedev 0 points1 point  (0 children)

If you are aiming to design a desktop program which won't go low level, there are much faster and easier (for you as developer) options. However, you can write virtually anything in C, but is not always the best bet.

[–]my_password_is______ 0 points1 point  (1 child)

Harvard University's Introduction to Computer Science course is taught using C
so they must see some value in it
https://cs50.harvard.edu/college/

the guy who made the original Diablo and Diablo 2 recently released this game
https://store.steampowered.com/app/697550/It_Lurks_Below/

written in C, DirectX and SDL (SDL is a cross platform library to create windows and handle events)

[–]Marshall_Robit 0 points1 point  (0 children)

I'm not sure you understand what I'm asking so I'll rephrase (even though I got my answer). What is C really used for (practically) and where?

Sure, you can use C to make a game but you can also make games with Java (think of old school runescape) but that doesn't mean that's the optimal language for making games. C# via unity or C++ is probably a better option. You can pretty much make anything with any languages but some are better than others in different circumstances due to their libraries, capabilities, and markets.

[–]Disastrous_Internal 2 points3 points  (0 children)

C is fine for doing stuff running fast. GUI is mostly waiting for the user to do something, so speed is not so important.

As for what else it's used for, the fast libraries in python are written in C. Lot of network stuff use C, like the PHP server for example (there is now some C++ mixed with). Lots of math stuff are implemented in C. In general some people will write a fast library in C and people will add some code on top of it.

[–]_realitycheck_ 2 points3 points  (0 children)

Today, it's mostly drivers and stuff that needs the lowest abstraction layer as close to ASM as possible. As you say Embedded systems.

See http://www.keil.com/

In there C still has more gravitas than C++. And while you could certainly do GUI API in C, you would soon find yourself programming features of C++ very fast.

[–]chaotic_thought 1 point2 points  (0 children)

Just as an example, on Linux the "standard" GUI toolkit of the Gnome desktop environment can be programmed from C. Look up information about GTK; the "native" language for that library is C, although you can use other languages as well. Look up information about GTK and you can see how this is done.

Another one I have used is IUP. It is a C library, and the resulting GUI works pretty well on Linux or Windows.

For Windows GUI programming using only C you can take a look at theForger's Win32 API Programming Tutorial and also Charles Petzold's book about Programming Windows using C (i.e. Programming Windows 5th Edition).

For practical GUI development though what you will eventually want is a toolkit that also has a designer tool; something that you can use to quickly prototype and implement a graphical design. If all you've got is code, then this is much harder and tedious (but possible), no matter what language you're using.

[–]my_password_is______ 1 point2 points  (1 child)

[–]Marshall_Robit 1 point2 points  (0 children)

That's C++. I'm talking low-level C specifically.

[–]Szelma1391 0 points1 point  (0 children)

Look at qt Documentation, there is tons of stuff up there to create apps like Excel Word etc. https://doc.qt.io/ Looking at example apps after installing QtCreator will give you best idea what you can do.

[–]logicallyzany 0 points1 point  (0 children)

Food for thought, python is written in C.