How rude!!

This is a discussion on How rude!! within the General Discussions forums, part of the Community Boards category; So i'm currently reading a book by Andre Lamothe on WinAPI32 game programmin using C i honestly do not know ...

  1. #1
    "Why use dynamic memory?"
    Join Date
    Aug 2006
    Posts
    186

    How rude!!

    So i'm currently reading a book by Andre Lamothe on WinAPI32 game programmin using C

    i honestly do not know if he is reflecting the main game industry in his code or not, but at one point in the book he says something like:
    "Try rewriting this game using classes......"

    how rude!

    I do not know why game programmers, like andre, just dont use classes. In my opinion (which is far from true, but still valid) object oriented programming is aimed toward game programming.

    I mean if you just think about it, why using pure C ? Why all the mess ?

    Why not just use class for every game unit?? It is even more "pretty" if you did that, because it is already a game in your code where everything is neatly having its own class and functions and contained to it self while having the ability to share functionality with other entites.... Just like in an shipped game!

    Could someone tell me, in the real world, do they still use C for games? Or are they enlightened using classes ?


    For games, code-wise, i think OOP should be the first option, and for the industry it should be the first option !

    what do you think?
    "C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg."-Bjarne Stroustrup
    Nearing the end of finishing my 2D card game! I have to work on its 'manifesto' though <_<

  2. #2
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    1,624
    I agree with you! I'm using classes for WINAPI32 programming, and believe me, the work pretty good!
    Devoted my life to programming...

  3. #3
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,441
    What's the context of that quote?
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  4. #4
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by Hussain Hani View Post
    I do not know why game programmers, like andre, just dont use classes. In my opinion (which is far from true, but still valid) object oriented programming is aimed toward game programming.

    I mean if you just think about it, why using pure C ? Why all the mess ?
    It's only "a mess" if you have never seriously coded in C, which obviously you have not. This is a common trap which some C++ programmers seem to fall into a certain point, when they think they are hot tish -- that the only valid way to do anything is the way I do it. Probably they are encouraged by other C++ programmers who are intimated by/have some sort of inferiority complex about the fact that a lot of very complex software (eg, your OS) is perplexingly coded in C! What are these goofs doing??? They don't even write classes and use all my fav C++ words!!

    You're wrong, that's all. I recommend you curb your excitement slightly. OOP is terrific but it is not the be all and end all of anything.
    Last edited by MK27; 03-25-2010 at 08:26 AM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  5. #5
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,662
    I do not see how it is rude to propose a challenge to your reader in your own book

    But yeah, you need to provide context. For all we know, Andre Lamothe could just as easily have written "try rewriting this game using structs".
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  6. #6
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,707
    Quote Originally Posted by MK27 View Post
    It's only "a mess" if you have never seriously coded in C, which obviously you have not. This is a common trap which some C++ programmers seem to fall into a certain point, when they think they are hot tish -- that the only valid way to do anything is the way I do it. Probably they are encouraged by other C++ programmers who are intimated by/have some sort of inferiority complex about the fact that a lot of very complex software (eg, your OS) is perplexingly coded in C! What are these goofs doing??? They don't even write classes and use all my fav C++ words!!

    You're wrong, that's all. I recommend you curb your excitement slightly. OOP is terrific but it is not the be all and end all of anything.
    Well, to be fair, C was more or less designed as a step-up from writing assembly language. It's facilities are really quite crude and primitive, when you get right down to it. That said, you can certainly write software of arbitrary complexity using C, but it isn't necessarily an easy thing to do (ever wonder why C programmers value their debuggers and memory-leak detection tools so much?). C++ may not be perfect, but it is nonetheless a remarkably flexible and powerful language - several orders of magnitude more so than C. The difference is a bit like shaving: you could pull each hair out with a pair of tweezers, or you could use a rotating head electric shaver. Both get the job done...but one of them is going to leave you with a very sore face!

  7. #7
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by Sebastiani View Post
    C++ may not be perfect, but it is nonetheless a remarkably flexible and powerful language - several orders of magnitude more so than C.
    I won't argue with that, however, what I would say it comes down to is C++ provides a lot of "ready-made" techniques to accomplish something and keep your code organized.

    C, on the other hand, does not, so you can just be sloppy and plug thoughtlessly away, or you can find ways to stay cleverly organized and I get, I think, a perfectly comfortable close shave. The problem is, this means your methods will tend to be more idiosyncratic and hard for others to discern (unless maybe they specialize in C, I would guess).

    Point being, the lack of syntax in C is only a constraint if you look at it that way. Also, not too sure about how much more or less a need for debugging there is in C vs C++, altho I'm new (grains of salt ) to the latter (and I do like C++), I could not honestly say that so far it has saved me much debugging. But then, maybe having started out with C makes me less prone to write errors that someone who primarily codes in C++ might make when working in C. Ie, the real debugging "problem" is when the C++ coder switches to C, and they don't have access to all the techniques and syntax that usually covers their ass Like, "Where's the creek? What's my paddle?"
    Last edited by MK27; 03-25-2010 at 11:30 AM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  8. #8
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,707
    Quote Originally Posted by MK27 View Post
    I won't argue with that, however, what I would say it comes down to is C++ provides a lot of "ready-made" techniques to accomplish something and keep your code organized.
    Exactly. Hell, the constructor/destructor paradigm alone has solved many of the most difficult problems in programming. Not to mention templates, allowing us to snap together new functionality and types so easily (like so many magic legos!). Then you have virtual function, which besides their obvious usefulness, are also quite helpful at bridging compile-time (eg: template) and run-time (eg: dynamic) components.

    Quote Originally Posted by MK27 View Post
    C, on the other hand, does not, so you can just be sloppy and plug thoughtlessly away, or you can find ways to stay cleverly organized and I get, I think, a perfectly comfortable close shave. The problem is, this means your methods will tend to be more idiosyncratic and hard for others to discern (unless maybe they specialize in C, I would guess).
    Eh, maybe. Then again, badly written code has little to do with the language chosen. I've seen C++ code that would make you cry, I promise, and C code that resembled a symphonic composition. It all boils down to the quality and thoughtfulness of the programmer, ultimately.

    Quote Originally Posted by MK27 View Post
    Point being, the lack of syntax in C is only a constraint if you look at it that way. Also, not too sure about how much more or less a need for debugging there is in C vs C++, altho I'm new (grains of salt ) to the latter (and I do like C++), I could not honestly say that so far it has saved me much debugging. But then, maybe having started out with C makes me less prone to write errors that someone who primarily codes in C++ might make when working in C. Ie, the real debugging "problem" is when the C++ coder switches to C, and they don't have access to all the techniques and syntax that usually covers their ass Like, "Where's the creek? What's my paddle?"
    Well, generally speaking, a language requires less debugging when less work is required to properly initialize an object. That's the problem with C. Declare, initialize, utilize, cleanup. So much can go wrong there, if you think about it. In C++, by comparison, as long as the ctor/dtor pair are designed properly, you only have to deal with the first and third steps. So, as far as C++ -> C, I'd say there is no real disadvantage there (if anything, C++ make you think *more* about the life-cycle of objects and thus would be an edge). On the other hand, going from C to C++ can be quite a challenge (was for me, at least).

  9. #9
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by Sebastiani View Post
    Well, generally speaking, a language requires less debugging when less work is required to properly initialize an object. That's the problem with C. Declare, initialize, utilize, cleanup. So much can go wrong there, if you think about it. In C++, by comparison, as long as the ctor/dtor pair are designed properly, you only have to deal with the first and third steps.
    It is not as if destructors write themselves, so that is sort of six and two threes. I just don't see clean-up as being that big a problem (if you can make a mess, you should know what the mess is without too much confusion, ie, this is not such a big deal). Vis, declare and initialize, to tread some thin ice: I'd rather separate them anyway, altho again no big deal.

    On the other hand, going from C to C++ can be quite a challenge (was for me, at least).
    Hmm -- to be honest it's been kind of a blast, like opening a closet and all these nifty gifts fall out. But I'd already gotten familiar with classes and objects in perl, etc, so that part comes "naturally". And templating is just a clunky version of dynamic typing. The biggest problem I've had is resisting the urge to just do something in a C way rather than figuring out the C++ syntax, esp. wrt to strings (kind of astonished people think the C++ string is some kind of great advance, to me it just seems different). I can see myself using C++ more than C in the future, sensibly enough; which does not mean I think there is anything wrong or "messy" about C, tho, also sensibly enough.

    Quote Originally Posted by Sebastiani View Post
    badly written code has little to do with the language chosen. I've seen C++ code that would make you cry, I promise, and C code that resembled a symphonic composition. It all boils down to the quality and thoughtfulness of the programmer, ultimately.
    Fer sure. That was my point in commenting on the thread; the OP has gone off the deep end according to a familiar pattern, perhaps. Only a weak or limited mind would perceive C programming as a weak or limited realm.

    C++ is the language of gaming, no doubt, and it would seem perfectly suited to it (being high level, and compiled). However, that does not make it foolish to write games in C or python or actionscript or probably even BASIC IMO. But if you want to be a "C++ snob" for some idoitic (and myopic) reason, the gaming world may be an easy community to do that within.
    Last edited by MK27; 03-25-2010 at 12:52 PM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  10. #10
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,707
    Quote Originally Posted by MK27 View Post
    It is not as if destructors write themselves, so that is sort of six and two threes. I just don't see clean-up as being that big a problem (if you can make a mess, you should know what the mess is without too much confusion, ie, this is not such a big deal). Vis, declare and initialize, to tread some thin ice: I'd rather separate them anyway, altho again no big deal.
    You're dreaming. It makes a *huge* difference. Well, if nothing else, a willingness to use C does indicate an uncanny level of patience, maybe.

    Quote Originally Posted by MK27 View Post
    Hmm -- to be honest it's been kind of a blast, like opening a closet and all these nifty gifts fall out of it. But I'd already gotten familiar with classes and objects in perl, etc, so that part comes "naturally".
    Sure, but mastering the language (eg: getting the most out of it) does take some time (for most, I think). Good to hear you're enjoying it, at least. Attitude is everything.

    Quote Originally Posted by MK27 View Post
    Fer sure. That was my point in commenting on the tread; the OP has gone off the deep end according to a familiar pattern, perhaps. Only a weak or limited mind would perceive C programming as a weak or limited realm.
    Describing C as a "weak" or "limited" language is a bit unfair, perhaps. How about "tedious"?

  11. #11
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by Sebastiani View Post
    Sure, but mastering the language (eg: getting the most out of it) does take some time (for most, I think).
    No doubt. However, I'm not one to settle for believing that because I don't know everything I obviously know nothing. You have to go with where you're at.

    The OP's attitude to me smacks of someone wallowing in their own ignorance, which is more like going with where you're not at.

    Describing C as a "weak" or "limited" language is a bit unfair, perhaps. How about "tedious"?
    You could say that of all strongly typed, strictly compiled languages (in relative terms, they are tedious, C++ included). 99% of the population would probably consider programming of any form very tedious. I guess it depends what turns yer crank.
    Last edited by MK27; 03-25-2010 at 01:11 PM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  12. #12
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,707
    Quote Originally Posted by MK27 View Post
    No doubt. However, I'm not one to settle for believing that because I don't know everything I obviously know nothing. You have to go with where you're at.

    The OP's attitude to me smacks of someone wallowing in their own ignorance, which is more like going with where you're not at.

    You could say that of all strongly typed, strictly compiled languages (in relative terms, they are tedious, C++ included). 99% of the population would probably consider programming of any form very tedious. I guess it depends what turns yer crank.
    Okay, fair enough. And yes, I do find that whole OOP-fever thing to be pretty misdirected (if not just a bunch of hyperbole altogether).

    What I was referring to earlier was the C++ language proper, eg: all of the facilities that it does offer. It's tough to beat the level of productivity that can be achieved with C++...C is just bound to be more "hands-on", and well, time-consuming.

  13. #13
    The larch
    Join Date
    May 2006
    Posts
    3,573
    It is not as if destructors write themselves
    It is quite possible to use C++ in a way that the destructors do "write themselves" (Those destructors are written by others - think std::string or boost::shared_ptr)
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

  14. #14
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,239
    Quote Originally Posted by anon View Post
    It is quite possible to use C++ in a way that the destructors do "write themselves" (Those destructors are written by others - think std::string or boost::shared_ptr)
    Destructors, assignment operators, and copy constructors arise from the most fundamental container types. Higher level types should almost never need any of these three types of functions. The only time I find myself writing one of the evil triad is if I'm creating a new fundamental container.

    And the motivation for the fundamental containers, of course, is precisely to avoid having to do it higher up.

    I hardly pay any attention to resource consistency, because it's automatically handled.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  15. #15
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    Well since there really isn't a game question here I'm going to move this to GD.

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. OT:Sorry for my rude behavior
    By moussa in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 06-03-2008, 06:20 AM
  2. Is it considered rude...
    By SlyMaelstrom in forum A Brief History of Cprogramming.com
    Replies: 9
    Last Post: 11-17-2005, 10:42 AM
  3. Enough with rude ppl!
    By SAMSAM in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 03-26-2003, 07:41 PM
  4. Are we too rude?
    By ober in forum A Brief History of Cprogramming.com
    Replies: 42
    Last Post: 03-04-2003, 07:01 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21