Advertisement

How many of you use C for game programming?

Started by January 24, 2011 04:33 AM
107 comments, last by Washu 13 years, 6 months ago

This is why we need a - button on the bottom of posts.


I don't really understand why that is a more rate-down-bait than the others in this thread. Okay, I'm sure no one gives a damn about my opinion, but at least I stated the conditions of the opinion.

@phresnel:
I admit that it was a pointless post
I find all of C gui libraries as ugly complex horrible api's. Very complex to use and write with. Take win32 for instance, it is very poorly written and designed. But at it's time of creation it was different. Now if Microsoft bothered writing an up to date that was much better and drop that ugly poor implementation of Hungarian notation it would be easier to use. Now if it was written like Gtk+ it wouldn't be so bad to use. But then again even Gtk+ is painful to use itself even though it is very well designed.

C has it's places and I don't criticise it for anything on that. But for a GUI library and application writing. It is horrible as hell and will never be suitable for it. Sadly almost anything system that has gui it's done in C. But when it's wrapped in another language (depending on the language) it can be really well designed and handled a lot better. C has it's advantage over other languages, just like X lang has advantage over Y language. Each languages serve their own purpose.

I refuse simply to write in C because the lack of decent gui's to use. I like my smart pointers, my containers, my string class that my gui library provides, auto, nullptr, the wide level of gui's that are out there though I only prefer 1 over any other because other's don't match it. C is too opened and doesn't provide containers in which you have to constantly write your own just to achieve it. There is no nice string class available, there is no polymorphism in C, no inheritance, no RAII, no smart pointers. What does C really even offer over C++ in the gui department, if C was really all that it's cracked up to be in that area, then why is everyone leaving it to use X/Y/Z languages?

C imho is only useful for systems/hardware/drivers/devices, anywhere else I find it completely useless as there are better things that can take it's place and make work much easier to do in half the time.

Anyone can write poorly in any language. But this is only from my eyes and what I've seen on many websites and projects. People have abused C so badly due to it's limitations, that they reinvent C++ in C just to achieve the same thing that C++ already has. Ever tried using C libraries mixed with C++ and those C headers full of macros and what not cause so much problems with your code because Macros don't have scope. It is a total nightmare to work with C in C++.

I might get flamed for this and maybe the rest but who cares. But also a lot of the problems C++ is the developers that come from C bring their bad habits with them and wonder why a lot of code out there is poorly written and designed. Have you ever read half of those C++ tutorials on websites, full of poorly written ones. For instance, "You should use printf than std::cout because it's like über 1337, it will make you code go zoom zoom zoom". Many of those tutorials just basically use C++ for the classes and it's native bool feature but ditch everything else for C. Like it actually going to make things better. FILE isn't better than std::fstream, or the other way around. But C++ has it's own classes. The only reason you still have printf and the alike it for compatibility reasons. If C++ wasn't compatible, you'd be pinvoke it or something similar just to use it and think it's like über 1337? That's like using C# and pinvoking all of C's functions in there and using those while not using anything else. Another would be using const char* over w/string.

That's why alot of poor C++ programmers are out there. Yeah there are some areas where you using functions not in classes for example. That's fine. Because novice C++ programmers believe what they read by C programmers who think they are writing good C++ code when they aren't like they are some experts in C++.

[font=arial, verdana, tahoma, sans-serif][size=2]

You're comparing a few standard library functions, not idiomatic use of the languages.

Also, Linus was flaming in that post, but he did have a point. C++ damn near encourages you to write bad code. You can write bad code in C of course, but it's usually way smellier.



C++ doesn't near encourage you to write poor code. Only you can write poorly code. C++ just makes code more cryptic if you do it good enough.
[/font]
Advertisement


You're comparing a few standard library functions, not idiomatic use of the languages.

Also, Linus was flaming in that post, but he did have a point. C++ damn near encourages you to write bad code. You can write bad code in C of course, but it's usually way smellier.



C++ doesn't near encourage you to write poor code. Only you can write poorly code. C++ just makes code more cryptic if you do it good enough.


[font="arial, verdana, tahoma, sans-serif"]C++ doesn't near encourage you to write poor code. Only you can write poorly code. C++ just makes code more cryptic if you do it good enough.
[/font]


Exactly. As you said, better C++ code tends to become cryptic. In other words, the language encourages you to write bad code, *exactly* because it is less cryptic.


Besides, I really can't see why anyone would write a GUI in C++ in this date and time (or any other non-GCed language for that matter). It's painful, it's error-prone and it's completely unnecessary.

The lack of built-in unicode support just puts the nail into its coffin, as far as GUIs are concerned.


[OpenTK: C# OpenGL 4.4, OpenGL ES 3.0 and OpenAL 1.1. Now with Linux/KMS support!]


Anyways, most of this extra code seems to be accessor functions and such. Not necessarily extra features.


There you go then - design issues, not language issues.

I personally found when I made the transition from C to C++ that my code got shorter, and that was long before I started learning to use C++ properly, which I'm still learning ten years on.

[quote name='Seaßourne' timestamp='1296639208' post='4768390']
[font="arial, verdana, tahoma, sans-serif"]C++ doesn't near encourage you to write poor code. Only you can write poorly code. C++ just makes code more cryptic if you do it good enough.
[/font]


Exactly. As you said, better C++ code tends to become cryptic. In other words, the language encourages you to write bad code, *exactly* because it is less cryptic.


Besides, I really can't see why anyone would write a GUI in C++ in this date and time (or any other non-GCed language for that matter). It's painful, it's error-prone and it's completely unnecessary.

The lack of built-in unicode support just puts the nail into its coffin, as far as GUIs are concerned.



[/quote]

Well frankly I don't have problems managing my own memory. While C# is good but it doesn't support Qt (The Qt bindings are unmaintained).
Advertisement
Well frankly I don't have problems managing my own memory.[/quote]

You just haven't worked on a big enough application. The underlying issues are still there, you just haven't hit them yet.

[OpenTK: C# OpenGL 4.4, OpenGL ES 3.0 and OpenAL 1.1. Now with Linux/KMS support!]


Well frankly I don't have problems managing my own memory.


You just haven't worked on a big enough application. The underlying issues are still there, you just haven't hit them yet.


[/quote]


Oh trust me I have. My own personal project is quite big and I don't have problems because I actually know how to control it and know how to properly use smart pointers and know when to delete and not delete it.

If you've never spent time hunting down a memory leak, that's great Seabourne. I imagine most of the rest of us have. I haven't had to in languages with automatic memory management and regardless of the other pros and cons, I consider that a benefit. I'm sure there are times when writing your own code to manage the memory is important, but I haven't encountered them yet myself. C# allows you to manage it yourself if you want to, and I imagine Java does as well, so I don't worry about encountering such a situation.

Now if Microsoft bothered writing an up to date that was much better and drop that ugly poor implementation of Hungarian notation it would be easier to use.[/quote]
I believe this is what .NET is. It works for me, and I enjoy it a lot better than I did Win32 and MFC. Win32 was kind of fun when I first used it because of the mystery of it, felt like I was using what real programmers used, but eventually I discovered I could make the same gui program five times faster and with very little pain in .NET.

If you've never spent time hunting down a memory leak, that's great Seabourne. I imagine most of the rest of us have. I haven't had to in languages with automatic memory management and regardless of the other pros and cons, I consider that a benefit. I'm sure there are times when writing your own code to manage the memory is important, but I haven't encountered them yet myself. C# allows you to manage it yourself if you want to, and I imagine Java does as well, so I don't worry about encountering such a situation.

Now if Microsoft bothered writing an up to date that was much better and drop that ugly poor implementation of Hungarian notation it would be easier to use.

I believe this is what .NET is. It works for me, and I enjoy it a lot better than I did Win32 and MFC. Win32 was kind of fun when I first used it because of the mystery of it, felt like I was using what real programmers used, but eventually I discovered I could make the same gui program five times faster and with very little pain in .NET.
[/quote]

Like I said the only thing that makes me not just to C# is due to my gui framework not being maintained because pretty much 99% are using the C++ one. My gui library handles pretty much all the memory for me that's why I don't really ever have to deal with memory leaks and I'm happy with it. the other gui's are just not available for cross platform since that's the development stuff I do. But let me be clear, I don't care if others think Linux or Mac doesn't have a high market. the people I target do so yeah. If C# offered a better cross platform api like Qt I'd jump but until then I'm sticking with C++ no matter how better C# gets.

This topic is closed to new replies.

Advertisement