What are you learning right now? My last side project was recently derailed and I am curious to hear what other people are spending their time studying/learning about.
I learnt programming mainly through various scripting languages, some of which had some relatively simple visual output available, which I personally found invaluable for learning and visualizing. I realized that better visual output was the main thing holding me back from doing more in C since there are so many options, often complex, involving much boilerplate. So my mini project is essentially exploring the simplest, most minimal possible ways of drawing pixels on the screen in Linux. So far tried fbdev (but doesn't work well with X), now playing with XCB.
Out of interest, why would people laugh at someone learning C? I know plenty of people using C in all manner of domains, choosing it over C++ or Rust for fair and sensible reasons - I'm not a C person myself, but it certainly seems extremely useful to have in the toolkit!
I've noticed this a lot on hackernews, there is an apprehesion to say certain things as though there is some sort of pedigree or gating when discussing topics, especially when it's personal...there isn't.
I want to learn C not (only) because I think it's useful, but because I think I might like it. I have a particular interpreted language that I like, enjoy and know inside out, now I want to know a compiled one in a similar way.
To answer your question: I get the impression from various tech news on "hot new languages" that C is the incumbent systems language that people put up with but don't really love, and yet I want to try and love it. I've developed a taste for minimalism, simplicity and a degree of brevity in programming, I have a feeling I might find C more suited to me than C++, Rust, Go, Java etc for this reason despite the lack of "modern" features.
I started coding 10 years ago (damn I just figured that...) learning C at my engineering school for 2 years. Never had to use it ever since (mostly working front-end and webAPIs) but I'm still glad I studied it to learn the programming foundations.
I would probably choose Rust or Go today though.
I suppose because of the perception that many programmers already know C. Which is true, but only some fraction know it well, which is far more important in C than in most modern languages.
> So far tried fbdev (but doesn't work well with X), now playing with XCB.
Another idea would be to use SDL which essentially provides functionality to make windows, draw pixels and handle input/output. If you do not want to use any library at all and do not mind low "resolution", you could use your terminal as window and regard characters as pixels. Sure, there is the curses library to abstract away different terminals, but if you do not care about platform independence you can just directly write escape sequences to the terminal.
I was indeed trying to avoid the big libraries, since this is just for personal use I don't care about cross platform which allows me to escape these potentially - I may well end up back at the SDL + OpenGL level later when features or performance are a concern.
My current goal is to find a balance of least dependencies and least boilerplate to draw a pixel buffer so i can play with C, nothing more. Once I can do that without lots of fluf then i may be attracted to more advanced or complex methods later on when performance is desirable. I have done some visual things with the console and printf alone in the past which gave me a taste of C, but now I want some real pixels :)
You may want to try raylib. It's written by a teacher who uses it in the classroom and geared for this kind of "let me code games in C but with only one dependency" goal. It does more than you need but that's a common theme of useful libraries.
My goal is to attain a balance of least dependencies and boilerplate. From what I've read so far it seems that implementing xclient protocols directly would require considerably more boilerplate than using XCB, (and my understanding is that XCB is just that: a generic xclient implementation and nothing more).
Please do elaborate if I'm wrong though! I would be delighted if it's possible to implement a simple subset minimally purely for displaying a pixel buffer without XCB?
Have you tried A
allegro5? Any take on which is better? I've tried both, but I'm too much of a newbie to have a reasonable opinion. Thinking of getting back on to one of the two.
I've done a lot of C programming over the years and I still consider it one of the most elegant languages I've had the opportunity to work with. With the right skillset, you can be as productive as a programmer of any other language or system. And it's great to see where some of the things we take for granted in programming, come from. If you want to draw pixels, give Cairo a try. It's fun to use!
Nice to hear from people still enthusiastic about C :)
Thanks for the suggestion, I hadn't considered Cairo, for some reason I thought it was only for SVG, maybe from it's use in Firefox. I will try it out once I get out of XCB territory.
Comments (876) 381 threads
Show all comments
Showing thread 18 of 381
I learnt programming mainly through various scripting languages, some of which had some relatively simple visual output available, which I personally found invaluable for learning and visualizing.
I realized that better visual output was the main thing holding me back from doing more in C since there are so many options, often complex, involving much boilerplate. So my mini project is essentially exploring the simplest, most minimal possible ways of drawing pixels on the screen in Linux.
So far tried fbdev (but doesn't work well with X), now playing with XCB.
Case in point: The comment below mine...
To answer your question: I get the impression from various tech news on "hot new languages" that C is the incumbent systems language that people put up with but don't really love, and yet I want to try and love it. I've developed a taste for minimalism, simplicity and a degree of brevity in programming, I have a feeling I might find C more suited to me than C++, Rust, Go, Java etc for this reason despite the lack of "modern" features.
I suppose because of the perception that many programmers already know C. Which is true, but only some fraction know it well, which is far more important in C than in most modern languages.
Another idea would be to use SDL which essentially provides functionality to make windows, draw pixels and handle input/output. If you do not want to use any library at all and do not mind low "resolution", you could use your terminal as window and regard characters as pixels. Sure, there is the curses library to abstract away different terminals, but if you do not care about platform independence you can just directly write escape sequences to the terminal.
My current goal is to find a balance of least dependencies and least boilerplate to draw a pixel buffer so i can play with C, nothing more. Once I can do that without lots of fluf then i may be attracted to more advanced or complex methods later on when performance is desirable.
I have done some visual things with the console and printf alone in the past which gave me a taste of C, but now I want some real pixels :)
Continue this thread — 1 reply
Please do elaborate if I'm wrong though! I would be delighted if it's possible to implement a simple subset minimally purely for displaying a pixel buffer without XCB?
Continue this thread — 4 replies
I've done a lot of C programming over the years and I still consider it one of the most elegant languages I've had the opportunity to work with. With the right skillset, you can be as productive as a programmer of any other language or system.
And it's great to see where some of the things we take for granted in programming, come from.
If you want to draw pixels, give Cairo a try. It's fun to use!
Thanks for the suggestion, I hadn't considered Cairo, for some reason I thought it was only for SVG, maybe from it's use in Firefox. I will try it out once I get out of XCB territory.