C programming language discussion

Everything todo with programming goes HERE.
Monkey
Match Winner
Posts: 725
Joined: Thu May 22, 2008 12:36 am
Location: England, UK

C programming language discussion

Post by Monkey »

I'm currently learning to program in C (I'm teaching myself). I know that C++ is probably more widely used nowadays and that Arma is written in C++, however I'm starting to feel that C is the way forward for me. I studied C++ at university, even though I didn't fully learn/use all features of the language. I used to believe that C++ was brilliant, however, now I'm starting to think that C is better because it's a much smaller and simpler language and I've become a big fan of the KISS (keep it simple stupid) philosophy. Also, the programmers, in the world, that I look up to, all seem to prefer C too, which does influence my decision as well. Note that I'm far from an expert in programming and I know that C has known issues. However, some say that C++ has even more issues.

Does anyone else program in C? What are your opinions on C vs C++ vs other languages?
Playing since December 2006

User avatar
kyle
Reverse Outside Corner Grinder
Posts: 1832
Joined: Thu Jun 08, 2006 3:33 pm
Location: Indiana, USA, Earth, Milky Way Galaxy, Universe, Multiverse
Contact:

Re: C programming language discussion

Post by kyle »

I think nowadays picking a language it is more practical to pick a language for what you are working on. C is a good language to teach you about pointers and memory management, and has a lot of application in micro-controllers. C++ adds in Classes, winch are extremely useful , sure you can make a struct in c that does similar, but it still misses scoping. According to the stackoverflow 2016-2018 developers survey, rusty is the most loved language. I've not used it, but it is on my languages to try list. but it's syntax is similar to c/c++.

I am working on a small android application. I've used java on and off for 10 years, I've seen lots of changes to it, but I am using this app as an opportunity to try Kotlin.
Image

User avatar
Lucifer
Project Developer & Local Moonshiner
Posts: 8610
Joined: Sun Aug 15, 2004 3:32 pm
Location: Republic of Texas
Contact:

Re: C programming language discussion

Post by Lucifer »

The simple rule to determine if you need to use C is this: are you developing a kernel? No? Then you don't need C.

For all other applications, games, and crap, picking a language is more about your personal style. I'm obsessive over formatting and prefer really flexible stuff, so Python is the obvious first choice for me. But if I'm writing a web app, I'll probably use PHP because it's more widely deployed on web servers. If I need high performance, I look for a framework that provides it, but if I can't find one, then it's either Java or C++, where C++ is more likely because I know it way better than Java, but I would pick Java for high performance non-media apps if I had to because the java virtual machines out there can get pretty close to C++ performance on a server platform.

But the two languages I don't currently know that I look at the most are Ada and Lua. Ada is interesting because of what it is, coupled with the fact that, as far as I know, computers still don't exist that are powerful enough to implement the full specification for the language written back in the 80s. Lua is interesting because it was explicitly designed for scripting applications, and if we were to continue armagetron in C++, I would insist we use Lua instead of either the existing Ruby stuff or the hypothetical python stuff. There are vast portions of arma code that doesn't need to be C++ and would be better served converted to a scripted language. Also, we need to consider what sort of professional experience our players could gain from working on parts of arma with a scripted interface, and lua is the most-deployed embedded scripting environment in the world, and the de facto scripting language for game studios. Basically, if I find the time and energy to do it, I wouldn't be surprised if all the Ruby stuff in arma disappeared and a fairly complete Lua implementation appeared in arma.

Then again, if we're willing to start from scratch, I'm going to push hard for Panda 3d, because it's professionally developed, high performance, has broad platform support (including an experimental Android port), and uses Python as the main language. :) When we need to write custom code in C++, Panda 3d provides a solid framework for us to use. In fact, based on Z-man's Godot experience, it wouldn't surprise me at all if he were able to find 40 hours or so over the course of a month and then built a pretty feature-filled arma client and server with Panda 3d, especially if he helped me with my game network library (which is pure python, for maximum portability).
Image

Be the devil's own, Lucifer's my name.
- Iron Maiden

Monkey
Match Winner
Posts: 725
Joined: Thu May 22, 2008 12:36 am
Location: England, UK

Re: C programming language discussion

Post by Monkey »

C has many more applications than just kernel/system programming. Take the Enlightenment window manager and, more importantly, the related EFL (Enlightenment Foundation Libraries). The EFL cover so many things and they're all written in C (mainly because their creators prefer C). Interestingly, they have bindings for C++, Python and Lua, with more language support to follow.

/Rant
The thing that gets me about the programming world is that there are too many new languages being made. In my opinion, languages take a long time to master (or maybe I'm just slower on the uptake than some of you guys) and so just when you get settled with one, suddenly lots of people decide it's obsolete and needs to be replaced with the next fancy, fandangled language, which is often not better enough than the one it was invented to replace. This doesn't just happen with programming languages; look at revision control software, Linux (cough systemd cough), etc. I'm all for progress but the current state of things is a mess.
/End of rant :)
Playing since December 2006

User avatar
delinquent
Match Winner
Posts: 660
Joined: Sat Jul 07, 2012 3:07 am

Re: C programming language discussion

Post by delinquent »

You're right in one sense - skills becoming obsolete doesn't take very long at all. We have it a hell of a lot harder today, given the hyper-progression of technologies driven in part by the mass-takeup of easily accessible technology. The skills I learned just three or four years ago are barely relevant now, and sometimes the incessant need to learn about new frameworks and concepts can be frustrating.

That said, some things don't change all that much. There is always going to be a need for data to be stored, accessed, and manipulated, which is why I've kept that as my primary expertise. Visual design is never going to stay the same long enough for me to really become an expert, so I tend to focus on DBMS, CMS, Visual Representation and Information Management. Put that with SaaS and there's a good recipe for a lifelong income, as well as manageable challenges.

User avatar
Lucifer
Project Developer & Local Moonshiner
Posts: 8610
Joined: Sun Aug 15, 2004 3:32 pm
Location: Republic of Texas
Contact:

Re: C programming language discussion

Post by Lucifer »

Monkey wrote:C has many more applications than just kernel/system programming. Take the Enlightenment window manager and, more importantly, the related EFL (Enlightenment Foundation Libraries). The EFL cover so many things and they're all written in C (mainly because their creators prefer C). Interestingly, they have bindings for C++, Python and Lua, with more language support to follow.
That's technically correct, but largely irrelevant. Enlightenment is outdated, hasn't done a great job keeping up with new technologies, and is *stuck* with C because that was the best language available when it was started as a project. Very similar to how Armagetron is C++ because that was the best language available at the time (and also because Z-man knew it already).

Nowadays, you only need C in the places where C was originally developed to operate, and that's kernel/system programming on computers with extremely limited resources (and kernels for any computers, because the kernel is the ultimate decider on your system's performance. Some of us remember the change from Linux 2.4 to 2.6 and how it was basically revolutionary for Linux at the time).

In all other ways, the costs associated with C (memory management, mostly), and the difficulty of writing strong cross-platform code (library availability, mostly) far outweigh the performance gains and flexibility of the overall language. Further, because C only fundamentally implements primitive programming constructs, newer languages have numerous features that make them far superior in terms of code durability and development time. In short, you can now write a primitive flight simulator in Python by following a tutorial and cranking out about 40 lines, and the tutorial itself takes about half an hour to complete. You get a high framerate, and what you're left with is easy to expand. Try the same thing with C, and in that first half hour, you're still writing memory management macros and you might have created a struct pointer for your window, but may not have opened it yet.

I grew up with C, I learned it in high school. I don't hate it, believe me. I also don't see it going away any time soon because there are strong needs for it all over the industry (besides desktop/server/phone kernels, there's all the microcontrollers that need C or a C-like language). But your average coder, using C is largely a waste of time when even just switching to C++ adds 10 times more features to the language and eliminates half the cost of development associated with C.
/Rant
The thing that gets me about the programming world is that there are too many new languages being made. In my opinion, languages take a long time to master (or maybe I'm just slower on the uptake than some of you guys) and so just when you get settled with one, suddenly lots of people decide it's obsolete and needs to be replaced with the next fancy, fandangled language, which is often not better enough than the one it was invented to replace. This doesn't just happen with programming languages; look at revision control software, Linux (cough systemd cough), etc. I'm all for progress but the current state of things is a mess.
/End of rant :)
I get tired of all the latest fads and buzzwords, but those aren't going to stop. I remember when C++ was "just a fad". Java was novel, but it was "write once, debug everywhere" and didn't really start getting useful until JVMs started appearing on phones, oddly enough (yes, I know there were wide server deployments at the time, but most of those are gone now because they were fads at the time).

I focus on the human-machine interface, because that's the universal timeless craft that isn't going away, no matter how many new buzzwords get dreamed up to describe pressing a button. Also, after you learn a couple of languages, new ones come easy enough that you can often times lie about knowing a language if you need to and then cram it in a few hours. Then you pass it off as "Well, it's been awhile/it was in alpha last time I used it/whatever" when people see you reading apidocs to figure out what to do next. :)

Also, a lot of concepts have stood up reasonably well over the years. OOP concepts are now everywhere, so much so that people are trying to make C work that way, too. So, whatever the hell Flex programming is, or I guess Agile's the current buzzword, it all means the same thing: write a few lines of code, check with the client, adjust your vision as needed. You know, what used to be called Xtreme Programming. :)
Image

Be the devil's own, Lucifer's my name.
- Iron Maiden

User avatar
kyle
Reverse Outside Corner Grinder
Posts: 1832
Joined: Thu Jun 08, 2006 3:33 pm
Location: Indiana, USA, Earth, Milky Way Galaxy, Universe, Multiverse
Contact:

Re: C programming language discussion

Post by kyle »

I think professionally it is a lot more about how to effectively program, than knowing a certain language. Just last week, at work, I touched, php, java, javascript, C and C#, so basically I spent time looking up how to do basic stuff specifically for each language. because If you are working with a language you have not touched that often, that's how you "know" the language, you know what to look up. There was one thing we spent weeks trying to get to work in C#, and ended up spending days making it work using python. Like Lucifer said, it's about how much time you want to spend working on a solution. The only reason why I am looking into Kotlin, is to see what It has to offer. If I have something that Rust would make sense to use, I'd use it.

But the best advice is, learn a language for what you want to eventually use. Once you learn 2 or 3, others will come easy. Also maybe look at the clean code book. A lot of good information in there, just note that in some languages concepts in there may be hard or imposible to do.
Image

Monkey
Match Winner
Posts: 725
Joined: Thu May 22, 2008 12:36 am
Location: England, UK

Re: C programming language discussion

Post by Monkey »

I get some of the comments, however I'm still not convinced that C is worse than the newer languages it has supposedly been made obsolete by. C++ is a good example. I'm no expert on either C or C++ but I know of people who are and the ones I respect the most are of the "C++ is a disease" "C++ takes an IQ of 1000 to understand" persuasion.
Lucifer wrote:newer languages have numerous features that make them far superior in terms of code durability and development time

The argument is that "numerous features" are actually a bad thing, not a good thing. The bigger and more complex the language, the harder it is to find bugs and there will usually be more bugs in the code too (bear in mind that no language is perfect in its design/implementation. I'll have to see how I feel once I actually do some proper C programming. So far, I've nearly finished reading a tutorial on the language and I'm liking the simplicity of it.
Lucifer wrote:Enlightenment is outdated, hasn't done a great job keeping up with new technologies
That is assuming that the new technologies are better than what was there already. Note that I don't use a desktop environment, being a minimalist I just use a simple window manager called CWM. However, I have tried GNOME, KDE and Enlightenment, just for fun, and I preferred Enlightenment out of the three. Maybe that's just me though. Also to note is that the EFL are used in commercial projects, such as on mobile phones.
Playing since December 2006

User avatar
Lucifer
Project Developer & Local Moonshiner
Posts: 8610
Joined: Sun Aug 15, 2004 3:32 pm
Location: Republic of Texas
Contact:

Re: C programming language discussion

Post by Lucifer »

Monkey wrote:I get some of the comments, however I'm still not convinced that C is worse than the newer languages it has supposedly been made obsolete by. C++ is a good el xample. I'm no expert on either C or C++ but I know of people who are and the ones I respect the most are of the "C++ is a disease" "C++ takes an IQ of 1000 to understand" persuasion.
I personally wouldn't trust someone who thinks they're not smart enough to understand C++. C++ is the most simplest implementation of object-oriented programming languages. Even PHP is more complex, nowadays, to say nothing of Python. Or Java, for that matter.

I'm not trying to be down on C, seriously. C is, for what it can do out of the box, probably the best-designed and most-tested of any programming language. In fact, the vast majority of the POSIX standard is about dictating which C libraries have teo be present, and what their expected behavior is. There's no getting around it, C still powers the world.

Kyle's comment that C doesn't support object-oriented programming is true to the extent that it doesn't do so out of the box, so if you need OOP, and you insist on using C, you have implement your own version of inheritance, polymorphism, and the other stuff that C++ already provides. You can do it, and I know it can be done, since the Python implementation that's produced by the Python Foundation and deployed all over the place is written in C, meaning every single feature that Python has can be written in C, and it was written in C.

The question isn't "can you do it", the question is "How long will it take". A lot of these features can be considered convenience features, and you can live without them, if you choose. But a lot of these features that are merely for convenience are the very same features that easily reduce 5-5000 lines of C code into one or two lines of Python code, and I've got better things to do with my time than re-implement all that code just because I think C is a great language. And that's not even mentioning the features that you get in "newer" languages that require thousands of lines in C to write. C++ provides templates, so you can have all sorts of data structures that all behave the same, but you'd otherwise have to write yourself. Then there's the Standard Template Library, which finally made it into the C++ standard and is both reliable and stable. All things that have been standard features of languages like PHP, Visual Basic, Python, Perl, SmallTalk (another language as old as C), Ada, etc. Sure, there's probably some C library out there that'll help you, but none will be as flexible, and that flexibility translates to development time. The more flexible the language, the less time it take to make an app that works and can be used.

Back in high school, I wrote an app in C on my Amiga 500 that generated D&D characters. It was complete, it was awesome, and it took me three days, working 12-16 hours a day. Also, it had no GUI, and you ended up having to copy, by hand, the generated character to a character sheet. Later, I rewrote the same app in AmigaBasic in about four hours, and it had a GUI, and it printed the character sheet. This would have been 1992. Conclusion? C was the wrong language for that app.
Lucifer wrote:newer languages have numerous features that make them far superior in terms of code durability and development time
The argument is that "numerous features" are actually a bad thing, not a good thing. The bigger and more complex the language, the harder it is to find bugs and there will usually be more bugs in the code too (bear in mind that no language is perfect in its design/implementation.
Just because it's harder to find bugs doesn't mean it's impossible, or even difficult. Actually, Ironically, it's usually the other way around. Exceptions, for example, made it 10 times easier to find bugs than before they existed. Then there's unit testing. And nothing beats just having a language exist for a long enough time that most of the critical bugs have all been found. Again, Python started development in 1991, with its first release in 1992, and was named after the same MTV reruns of Monty Python's Flying Circus that I was watching when I wrote my D&D character generator. Given all the work that's been done on it, there's absolutely no way you're going to write code that's as stable as what's in the current Python distributions that can do even a tenth of what Python can do. All these extra features are only more bug-ridden during their early implementations. Most of the major languages in use today are 15-30 years old (or older) and have been thoroughly vetted for bugs. It's the difference between driving a Model T and driving a brand new Toyota Camry. Sure, your Model T is easy to work on and has a very simple design, but if you want to safely travel faster than 20mph, you're going to have to do a lot of work customizing it, and what you'll be able to accomplish still won't match that Camry driving off the dealer's lot.
I'll have to see how I feel once I actually do some proper C programming. So far, I've nearly finished reading a tutorial on the language and I'm liking the simplicity of it.
All that said, it's worth learning C. :) Consider a problem I have in my game network library. I have a list of all game objects that need to be synced. I'm still working on the initial implementation, but I'm using a simple python list to store all the objects. That means that everytime I iterate through the list, I have to go through the entire list to find what objects need to be synced. That's the Linux 2.4 method of task scheduling, where the length of time it takes to give every task some CPU time is governed by that dreaded O(n) bit, where the length of time it takes to get CPU time is dependent on how long the list is. Only, I'm looking at how often objects get synced over the network. Now, someone who came up through the programming ranks starting in the 2000s might try to use a dictionary to speed things up. Or they might only sync a few objects every iteration. I'm going to ultimately use a binary list, instead. And the entire reason I know how to use these things is because we studied them in high school when I learned Pascal. I can't honestly guarantee I would even know to do something like that if I hadn't studied data structures back when you had to roll your own because none of these fancy libraries existed yet.
Lucifer wrote:Enlightenment is outdated, hasn't done a great job keeping up with new technologies
That is assuming that the new technologies are better than what was there already. Note that I don't use a desktop environment, being a minimalist I just use a simple window manager called CWM. However, I have tried GNOME, KDE and Enlightenment, just for fun, and I preferred Enlightenment out of the three. Maybe that's just me though. Also to note is that the EFL are used in commercial projects, such as on mobile phones.
Enlightenment is now getting relegated to resource-limited systems, true. But hell, Mythbuntu even changed from enlightenment because they needed better input handling while still staying lightweight. Now they're using XFCE, because it (ironically) provides the best touch-screen support as well as game controller support (they use lirc for infrared input, so the DE doesn't matter for that). Maybe you should check out XFCE. :)
Image

Be the devil's own, Lucifer's my name.
- Iron Maiden

Monkey
Match Winner
Posts: 725
Joined: Thu May 22, 2008 12:36 am
Location: England, UK

Re: C programming language discussion

Post by Monkey »

Lucifer wrote:I personally wouldn't trust someone who thinks they're not smart enough to understand C++. C++ is the most simplest implementation of object-oriented programming languages. Even PHP is more complex, nowadays, to say nothing of Python. Or Java, for that matter.
Not that he's necessarily one of the people I was talking about, but Linus Torvalds hates C++, calling it a "horrible language". If you don't trust Linus, maybe you shouldn't use Linux or Android :)
Also, just because there are even more complex languages, that doesn't make C++ being more complicated than C a good thing.
Lucifer wrote:if you need OOP, and you insist on using C, you have implement your own version of inheritance, polymorphism, and the other stuff that C++ already provides.
That is assuming that those features are actually a good thing. Years ago I thought they were. Now I'm not so sure, I'm doubting what I once believed.
Lucifer wrote:The question isn't "can you do it", the question is "How long will it take".
This may be a problem for me if I choose to program in C. I need to have a good look into what libraries are already out there that I can use. Surely there must be some libraries that are written in other languages that have bindings for C too though?
Lucifer wrote:Back in high school, I wrote an app in C on my Amiga 500 that generated D&D characters. It was complete, it was awesome, and it took me three days, working 12-16 hours a day. Also, it had no GUI, and you ended up having to copy, by hand, the generated character to a character sheet. Later, I rewrote the same app in AmigaBasic in about four hours, and it had a GUI, and it printed the character sheet. This would have been 1992. Conclusion? C was the wrong language for that app.
Firstly, high five for Amiga 500 and AmigaBasic :)
I wrote a Minesweeper clone in AMOS (I think that's the AmigaBasic you're talking about?) on my Amiga 500. Anyhow, I'm hoping that there are some time-saving C libraries for me to use nowadays that maybe weren't around back in the Amiga 500 days. Also, just because something takes longer (which is a pain I must admit), doesn't necessarily make it worse.
All that said, it's worth learning C.
Yes, I agree with that. However it turns out, at least I'll be able to write drivers for my hardware that don't currently exist in my OS.
Lucifer wrote:Enlightenment is now getting relegated to resource-limited systems, true. But hell, Mythbuntu even changed from enlightenment because they needed better input handling while still staying lightweight. Now they're using XFCE, because it (ironically) provides the best touch-screen support as well as game controller support (they use lirc for infrared input, so the DE doesn't matter for that). Maybe you should check out XFCE.
Mythbuntu is discontinued. MythTV is still going I think. I tried it about three years ago on Linux and it was buggy as hell. As for XFCE, I've heard good things about it. I tried Midori for a bit a year or so ago but it was too incomplete so I went back to Firefox. Firefox is a pretty good example of software written in C++ (well, at least partly) that has a poor security record. I use it because the alternatives are even worse :(
Playing since December 2006

User avatar
Lucifer
Project Developer & Local Moonshiner
Posts: 8610
Joined: Sun Aug 15, 2004 3:32 pm
Location: Republic of Texas
Contact:

Re: C programming language discussion

Post by Lucifer »

Monkey wrote:
Lucifer wrote:I personally wouldn't trust someone who thinks they're not smart enough to understand C++. C++ is the most simplest implementation of object-oriented programming languages. Even PHP is more complex, nowadays, to say nothing of Python. Or Java, for that matter.
Not that he's necessarily one of the people I was talking about, but Linus Torvalds hates C++, calling it a "horrible language". If you don't trust Linus, maybe you shouldn't use Linux or Android :)
Bad example. :) Your original statement was people saying you need an IQ of 1000 to understand C++, which is different than simply hating C++, coming from a guy who's spent his entire adult life working on a kernel, which is the primary condition I gave for using C in the first place. :)

Guido Whats-his-face LOVES C, because it's the only language he sees it being useful and convenient to use to implement Python, hence CPython is the reference implementation.

RMS also hates C++, which is why he insisted that GTK be written in C. Then the KDE guys came along and wrote a DE that was rapidly overtaking GNOME in popularity, but used a proprietary C++ GUI library. THAT is the canonical example of the power of C++ over C for rapidly developing software.
Also, just because there are even more complex languages, that doesn't make C++ being more complicated than C a good thing.
Conversely, C++ being more complicated than C isn't also an inherent bad thing.
Lucifer wrote:if you need OOP, and you insist on using C, you have implement your own version of inheritance, polymorphism, and the other stuff that C++ already provides.
That is assuming that those features are actually a good thing. Years ago I thought they were. Now I'm not so sure, I'm doubting what I once believed.
If those features weren't a good thing, then the "fad" that C++ once was would've faded out back in the 90s. now, instead, every language tries to implement those things, and much, much more (metaclasses in python and interfaces in Java, for example). I genuinely don't believe that all of the technological advances made over the last 30 years would have been possible without OOP. At least, it would have taken 50+ years instead.
Lucifer wrote:The question isn't "can you do it", the question is "How long will it take".
This may be a problem for me if I choose to program in C. I need to have a good look into what libraries are already out there that I can use. Surely there must be some libraries that are written in other languages that have bindings for C too though?
THAT depends on what you're looking to write. You can use the Python C library to access the Python Standard Library from C, but then you have to load a Python interpreter and performance will suffer. C's primary advantage is high performance. Other languages, well, depends on the language. If it uses an interpreter, you probably don't want to use it, and there aren't that many procedural languages left that are used regularly. You might be able to access FORTRAN or COBOL libraries from C while listening to your 8-track player.
Lucifer wrote:Back in high school, I wrote an app in C on my Amiga 500 that generated D&D characters. It was complete, it was awesome, and it took me three days, working 12-16 hours a day. Also, it had no GUI, and you ended up having to copy, by hand, the generated character to a character sheet. Later, I rewrote the same app in AmigaBasic in about four hours, and it had a GUI, and it printed the character sheet. This would have been 1992. Conclusion? C was the wrong language for that app.
Firstly, high five for Amiga 500 and AmigaBasic :)
I wrote a Minesweeper clone in AMOS (I think that's the AmigaBasic you're talking about?) on my Amiga 500. Anyhow, I'm hoping that there are some time-saving C libraries for me to use nowadays that maybe weren't around back in the Amiga 500 days. Also, just because something takes longer (which is a pain I must admit), doesn't necessarily make it worse.
The only AMOS I'm familiar with is the AlphaMicro Operating System, a mainframe system powered by a 68000 CPU.

There are libraries available. That's easy. There's GTK, of course. PortAudio gives you sound device access in a cross-platform way. I believe OpenAL is a C library, as well as all OpenGL specs. Most audio processing libraries are C libraries. MPlayer and VLC are both C apps. But then again, you can use all these libraries from C++, and gui libraries in C++ are 10 times easier to work with. But you can use Glade to prototype your GTK apps.

But then, Freeciv is written in C, and they hit a wall due to C limitations, and ended up implementing Lua, which is OOP.

Also, the length of time it takes to make something directly affects the value of that thing. If I give my wife a recipe and she takes four hours carefully preparing every little thing, and it tastes identical to when I make that recipe in 30-45 minutes, can you really say that her work was more valuable? People in food get fired for that kind of performance. Programmers, too.
All that said, it's worth learning C.
Yes, I agree with that. However it turns out, at least I'll be able to write drivers for my hardware that don't currently exist in my OS.
That's easier said than done. Not impossible, of course. The part of hardware drivers that is the most difficult to replace with open source replacements is the firmware. Drivers these days implement most of the work in the firmware, and the part in C tht connects to the HAL is just a skeleton whose sole purpose is to load the firmware.
[/quote]
Lucifer wrote:Enlightenment is now getting relegated to resource-limited systems, true. But hell, Mythbuntu even changed from enlightenment because they needed better input handling while still staying lightweight. Now they're using XFCE, because it (ironically) provides the best touch-screen support as well as game controller support (they use lirc for infrared input, so the DE doesn't matter for that). Maybe you should check out XFCE.
Mythbuntu is discontinued. MythTV is still going I think. I tried it about three years ago on Linux and it was buggy as hell. As for XFCE, I've heard good things about it. I tried Midori for a bit a year or so ago but it was too incomplete so I went back to Firefox. Firefox is a pretty good example of software written in C++ (well, at least partly) that has a poor security record. I use it because the alternatives are even worse :(
Mythbuntu isn't discontinued, they've just stopped releasing with non-LTS releases. Now they include their own repositories for each new release, and you can update/upgrade mythtv through there.

Firefox is a terrible example of a successful project, and it has absolutely nothing to do with their choice of languages. In fact, Firefox having such a program with gloat and feature-creep was what created the market for WebKit and Chrome. The last Firefox I genuinely enjoyed using was called Mozilla 0.94. I had high hopes for XUL as an app development platform, but then it fell flat on its face. The concept is now reallly popular, but XUL lost the tech war on that one. now its all Ajax, or what they're calling WPA, which is the same thing. :)
Image

Be the devil's own, Lucifer's my name.
- Iron Maiden

Monkey
Match Winner
Posts: 725
Joined: Thu May 22, 2008 12:36 am
Location: England, UK

Re: C programming language discussion

Post by Monkey »

Linus stated that he hates C++ specifically because of its complexity. Also, he doesn't just write kernels, don't forget that he created git. Admittedly git is written in various languages (although no C++) :P
Lucifer wrote:the power of C++ over C for rapidly developing software.
Personally speaking, I'm not that bothered about speed of development, I'd rather have software that is better and took longer to create (hence why I switched from Linux to OpenBSD). I'm sure I'm in the minority here.
Lucifer wrote:C++ being more complicated than C isn't also an inherent bad thing.
My belief is that it is a bad thing however I'm not expert enough yet to debate this. Again, I'm sure I'm in the minority here.
Lucifer wrote:If those features weren't a good thing, then the "fad" that C++ once was would've faded out back in the 90s. now, instead, every language tries to implement those things, and much, much more (metaclasses in python and interfaces in Java, for example). I genuinely don't believe that all of the technological advances made over the last 30 years would have been possible without OOP. At least, it would have taken 50+ years instead.
If most people are doing it then it must be good? What technological advances do you mean, by the way?
Lucifer wrote:Also, the length of time it takes to make something directly affects the value of that thing. If I give my wife a recipe and she takes four hours carefully preparing every little thing, and it tastes identical to when I make that recipe in 30-45 minutes, can you really say that her work was more valuable? People in food get fired for that kind of performance. Programmers, too.
I used to be a professional chef in a high end restaurant. We'd take a long time making food and people were willing to pay more money because the food was very good. As for the computer industry, yes I'm sure most companies have targets for their programmers. I'm glad I'm not a part of that industry.

Some people even believe that C is too complicated and a newer language needs to be created that is simpler than it. Whether or not I'm in the wrong with all of this, I'm still going to try to do what I can with C (I'm stubborn). We'll see what happens...
Playing since December 2006

User avatar
Lucifer
Project Developer & Local Moonshiner
Posts: 8610
Joined: Sun Aug 15, 2004 3:32 pm
Location: Republic of Texas
Contact:

Re: C programming language discussion

Post by Lucifer »

Monkey wrote:Linus stated that he hates C++ specifically because of its complexity. Also, he doesn't just write kernels, don't forget that he created git. Admittedly git is written in various languages (although no C++) :P
Odd, then, because C++ isn't that complex. It's basically what you get when you allow function pointers to be members of structs, and the logical things that that allows (inheritance and polymorphism). It's called C++ because it really is just C with a few additions to it. Like, instead of a platform specific malloc behavior (as well as other different ways to allocate memory), C++ got the new operator as part of the language, eliminating all previous problems with malloc. Of course, Linus would see that differently, since he wrote the program that allocates memory in the first place when malloc is called (the kernel). He may also still be stuck with the implementation of C++ that came out when he was still writing a terminal app before it became a kernel, which was still of questionable value over C (at the time, I stuck with C. I wasn't sold on C++ until the 2000s started). It took quite literally the Borland C++ Builder and the Standard Template Library to finally get me on board with C++. That level of code re-usability just isn't available in C.
Lucifer wrote:the power of C++ over C for rapidly developing software.
Personally speaking, I'm not that bothered about speed of development, I'd rather have software that is better and took longer to create (hence why I switched from Linux to OpenBSD). I'm sure I'm in the minority here.
Manufacturing is a good metaphor here, as well. And one that serves you well while making my point. I think we can safely say that Volvo makes some of the best cars in the world, and each one is handmade. Their parent company, Ford, on the other hand, makes some of the worst cars in the world, but they make a shitload of them every year (I'm biased, because Fords in the 90s really were shitty cars, but they've actually gotten a lot better). Subaru used to focus on handmade, as well, and have always been highly rated.

But then, "better" is still relative. I think software in a POSIX environment is overall better because the vast majority of it is Free as in Freedom. Yet, their proprietary counterparts in Windows/Mac OS X tend to be much more feature rich, but quite a bit buggier. I'm actually much closer to being a BSD person than a Linux person, it's just that I want more hardware support, which Linux does better than BSD, in general. So, again, which kernel is the best? In this case, they're all written in C, so the language isn't the determining factor.... (Maybe the GNU kernel is the best because it doesn't have to compete with anybody)
Lucifer wrote:C++ being more complicated than C isn't also an inherent bad thing.
My belief is that it is a bad thing however I'm not expert enough yet to debate this. Again, I'm sure I'm in the minority here.
Not necessarily. There're plenty of people who still believe the older American muscle cars are better than anything on the market today, and it's a good argument. They're faster, have simpler designs, and tend to be luxurious in internal space compared to anything we've got now. Then again, newer cars are more fuel efficient, faster compared to their engine sizes, and are safer in a collision. Overall complexity between the two is that newer cars are like 1000 times more complex. So it's really a matter of what you want (don't get the old muscle cars, they're big time climate change nightmares).
Lucifer wrote:If those features weren't a good thing, then the "fad" that C++ once was would've faded out back in the 90s. now, instead, every language tries to implement those things, and much, much more (metaclasses in python and interfaces in Java, for example). I genuinely don't believe that all of the technological advances made over the last 30 years would have been possible without OOP. At least, it would have taken 50+ years instead.
If most people are doing it then it must be good? What technological advances do you mean, by the way?
No, this isn't the Appeal to the Masses fallacy. This is more like previous technological competitions. With cars, the competition was initially steam vs electric vs internal combustion (which broke down into ethanol vs diesel vs gasoline). Or the competition between the various smokeless powders in the late 19th century. Or the competition between tubes and transistors in the 60s and 70s. Hell, even the VHS vs Betamax competition. In each case, one particular tech came out on top as the "best" for a variety of reasons, including market factors. Gasoline was easiest to produce in large quantities, even though diesel motors were of a simpler design. One particular smokeless powder proved easiest to produce en masse (developed by Alfred Nobel, iirc). Transistors won because of their size and speed compared to tubes, and now I'm using a computer that has billions of transistors in it (the same computer built with tubes would take up the entire state of Texas). And, of course, VHS tapes had more room on them so you could watch a feature length film without having to change tapes.

The difference here, though, is that C isn't obsolete. It didn't get beat out. Even core GUI toolkits are written in C (the winAPI, Xlib, etc). Their C++ counterparts just wrap the C toolkits. I think even the Java Virtual Machines that are out there are written in C. Basically, every line of code written in a non-C language still goes through compiled C code to run. Except for other compiled languages, but the only ones coming to mind are Pascal and Ada. Pascal is as simple as C, but not as flexible.
Lucifer wrote:Also, the length of time it takes to make something directly affects the value of that thing. If I give my wife a recipe and she takes four hours carefully preparing every little thing, and it tastes identical to when I make that recipe in 30-45 minutes, can you really say that her work was more valuable? People in food get fired for that kind of performance. Programmers, too.
I used to be a professional chef in a high end restaurant. We'd take a long time making food and people were willing to pay more money because the food was very good. As for the computer industry, yes I'm sure most companies have targets for their programmers. I'm glad I'm not a part of that industry.
Ahh, there's a difference between a few professional chefs taking their time to make something perfect. I went with the example I did because we're both hobbyists, and so are may wife and I in the kitchen. She's cooked like 4 times a year since she was a teenage. In that same time, I've cooked more like 4-7 times a week. Some stuff that she obsesses over and takes 20 minutes to complete, I can complete in a few minutes, simply due to experience. By that same reasoning, a lot of the stuff I find a pain in the ass in C, more experienced C programmers have some header files of their own that just provide it. I've seen folks using obviously boilerplate templates to handle linked lists, doubly-linked lists, and binary trees. The C standard library provides lots of useful ways to handle more complex data structures, too.
Some people even believe that C is too complicated and a newer language needs to be created that is simpler than it. Whether or not I'm in the wrong with all of this, I'm still going to try to do what I can with C (I'm stubborn). We'll see what happens...
You should direct those people to Lisp. Lisp vs C is one of the classic flamewars, after all.

I'm not trying to talk you out of C, by the way. It's a fun language, and every now and then I wonder if I should go write something in C just for the hell of it. But then I remember that Python exists, and I'm happy to live in a world with such a beautiful thing as Python in it. :)
Image

Be the devil's own, Lucifer's my name.
- Iron Maiden

User avatar
kyle
Reverse Outside Corner Grinder
Posts: 1832
Joined: Thu Jun 08, 2006 3:33 pm
Location: Indiana, USA, Earth, Milky Way Galaxy, Universe, Multiverse
Contact:

Re: C programming language discussion

Post by kyle »

Lucifer wrote:I'm not trying to talk you out of C, by the way. It's a fun language, and every now and then I wonder if I should go write something in C just for the hell of it. But then I remember that Python exists, and I'm happy to live in a world with such a beautiful thing as Python in it. :)
:) yes, that thing we tried for weeks in C# i also spent part of a day trying to do it in c and was like python will be quicker.

@monkey, take your time and learn C for now, since it seams you have the time. I love the simplicity of the C language myself, but I also hate the amount of code needed to do some simple things. I've wrote some of my own Data structures in it before, it's a lot of fun, but the time it takes is sometimes not reasonable for the application. Just know when you have a brick wall problem your trying to implement in minimal time that taking a look at other languages that may make it easier.
Image

Monkey
Match Winner
Posts: 725
Joined: Thu May 22, 2008 12:36 am
Location: England, UK

Re: C programming language discussion

Post by Monkey »

I understand and agree with you guys in that C programming is often going to take more time to accomplish tasks that other languages can do quicker. This doesn't bother me too much (yet) but I think I won't try to do anything too large to start with. At the very least learning C will help me to see how my OS works and, eventually, maybe I'll even be able to add to my OS.
Lucifer wrote:C++ isn't that complex. It's basically what you get when you allow function pointers to be members of structs, and the logical things that that allows (inheritance and polymorphism). It's called C++ because it really is just C with a few additions to it.
I have to admit that I like the fact C++ classes have methods/functions within them (encapsulation or whatever the buzzword is for this). However, I'm not sure that C is Just C++ with a few additions. From what I remember of C++, there's lots of extras: encapsulation, inheritance, polymorphism, operator overloading, scoping differences, cout/cin/whatever, templates, virtual functions, etc.
Lucifer wrote: I'm actually much closer to being a BSD person than a Linux person,
Good to hear :)
Patrick Volkerding, the guy that is Slackware says the same. Slackware is probably the best Linux distro I've used and it's more like BSD than any other I've used.
Lucifer wrote:it's just that I want more hardware support, which Linux does better than BSD, in general.
Linux has much more hardware support than any BSD true, but I wouldn't say that Linux does hardware support better than the BSDs. A good example is (or at least was) the differing APIs for different architectures that Linux has (or at least had). OpenBSD uses one API for all architechtures, keeping machine-independent code together and machine-dependent code seperate; it's all nice and tidy. Another example is kernel modules; OpenBSD doesn't have any. The reasoning behind this is that using kernel modules can produce race conditions (i.e. bugs). Also, everyone uses the same kernel (called "GENERIC"). Therefore bugs can be reproduced more easily/consistently. There's no compiling your own kernel (well, you can but it's not encouraged other than for kernel hacking).
Lucifer wrote:Maybe the GNU kernel is the best because it doesn't have to compete with anybody
Yeah, good luck with that. GNU is a recursive acronym, standing for GNU's Not Usable. Harsh but true.
Lucifer wrote: Lisp vs C is one of the classic flamewars, after all.
Yes it is. So is vi vs EMACS. It's probably obvious that I'm a vi guy. I used Vim for years until I decided it was too complex and switched to vi. I do miss multiple undos but other than that, I haven't looked back :)
Playing since December 2006

Post Reply