Jump to content


I like C


52 replies to this topic

#1 baldurk

    Senior Member

  • Members
  • PipPipPipPip
  • 1057 posts

Posted 30 April 2003 - 05:15 PM

I like C. I prefer it over C++, or rather I like more of C than C++. Although I do use a mixture, It's mostly C code. Anyone else?
baldurk
He who knows not and knows that he knows not is ignorant. Teach him.
He who knows not and knows not that he knows not is a fool. Shun him.

#2 Dia

    DevMaster Staff

  • Administrators
  • 1120 posts

Posted 30 April 2003 - 06:49 PM

actually I like C++ more than C. C++ is my beloved language :)

#3 DarkLight

    Member

  • Members
  • PipPip
  • 57 posts

Posted 30 April 2003 - 07:28 PM

I think object oriented languages are better for Game developing
I like object oriented languages more than procedural ones
Hence I like C++ more than C
<a href='http://www.kaldata.net' target='_blank'>kaldata.net - IT News</a>

#4 baldurk

    Senior Member

  • Members
  • PipPipPipPip
  • 1057 posts

Posted 01 May 2003 - 05:18 PM

that's the only part of C++ I use - classes, for organisation. I don't however use the more advanced OO things, like polymorphism etc. I can see how they would be useful. I definitely couldn't write in pure C++ though unless I was being paid to
baldurk
He who knows not and knows that he knows not is ignorant. Teach him.
He who knows not and knows not that he knows not is a fool. Shun him.

#5 DarkLight

    Member

  • Members
  • PipPip
  • 57 posts

Posted 01 May 2003 - 08:09 PM

in one book of Game programming is written, that in game programming you should not ise these advanced things but keep code simple. However, I use classes and methods but I rarely use virtual ones
<a href='http://www.kaldata.net' target='_blank'>kaldata.net - IT News</a>

#6 CyraX

    Valued Member

  • Members
  • PipPipPip
  • 144 posts

Posted 02 May 2003 - 11:17 AM

I like to use C++ - for organization.
I would NEVER dare to use Polymorphism - slows down the code. Inheritance - Building hte parent classes before my beloved class is instantiated.
C is more mature than C++. You need C++ ONLY for enterprise applications where speed is secondary. In gamez we have speed as the primary thing.
Anyone else feels that same?
I dont use "new" rather use malloc.
Everything that dear Bjarn Stroustrup said was for enterprises... not for us game developers :rolleyes:

#7 anubis

    Senior Member

  • Members
  • PipPipPipPip
  • 2225 posts

Posted 02 May 2003 - 01:54 PM

i object that speed is the primary concern in games. it might have been but times have changed and clean and easy to understand code has become more and more important as games and engines grow more and more complex. one good example is the nebula device from radonlabs. the virtual filesystem they created was only possible with oop. it's just amazing to have every object, every texture, every mesh and shader accessible through the console ( look at it if you don't know it, it's a great engine ).
so, c++ is my prefered language. my general aproach when designing my code is to seperate it into two catogories.

1. the code that is not speed sensitive, like loading resources, etc. here i use all the features that c++ gives me to write the cleanest code possible.
2. parts of the game/engine where speed is important, here i still use c++ but try to minimize the use of polymorphism, virtual functions, etc.

in fact i believe that if you write good c++ code the speed problem is totally irelevant 90% of the time. if you are passing down 5000 triangles in one vertex buffer that one virtual function call won't hurt you but will gvie you an easy way to abstract the gfx api you are using.
If Prolog is the answer, what is the question ?

#8 baldurk

    Senior Member

  • Members
  • PipPipPipPip
  • 1057 posts

Posted 02 May 2003 - 05:11 PM

anubis: I think you may be missing the point. You don't have to use all of C++'s features to write OO code. Simply classes and most likely inheritance. That's all

CyraX: I don't know why, but I find that for more complicated memory allocation commands new is easier than malloc. Just my opinion though
baldurk
He who knows not and knows that he knows not is ignorant. Teach him.
He who knows not and knows not that he knows not is a fool. Shun him.

#9 anubis

    Senior Member

  • Members
  • PipPipPipPip
  • 2225 posts

Posted 02 May 2003 - 10:47 PM

baldurk : i was just making a point that things that once were useful only in enterprise applications become more important in game development, too.
If Prolog is the answer, what is the question ?

#10 UnknownStranger

    Valued Member

  • Members
  • PipPipPip
  • 139 posts

Posted 03 May 2003 - 08:20 AM

Speed will always be a matter(that's why asm is still used...)...
But today, it's mostly much more important to have a clean, flexible code and short development times(that's why asm is only used for single, easy to overview functions... :D )...
M.E.
-----
"Human stupidity is something you can rely on." -- M.A.
"I didn't design life." -- J.G.
"It's almost finished..." -- EHD

#11 anubis

    Senior Member

  • Members
  • PipPipPipPip
  • 2225 posts

Posted 03 May 2003 - 09:27 AM

as i said. you have to find out were to use what.
If Prolog is the answer, what is the question ?

#12 UnknownStranger

    Valued Member

  • Members
  • PipPipPip
  • 139 posts

Posted 03 May 2003 - 09:31 AM

Oops...maybe I should read former posts, before just posting my own opinion... B)
M.E.
-----
"Human stupidity is something you can rely on." -- M.A.
"I didn't design life." -- J.G.
"It's almost finished..." -- EHD

#13 CyraX

    Valued Member

  • Members
  • PipPipPip
  • 144 posts

Posted 05 May 2003 - 02:08 PM

I accept that clean code is very important.
that was exactly why I said - I USE C++ classes... nothing else is required.
Did you ever try playing Q ]I[ on a system that sucks? Perhaps that is when you would realise that speed is important. Without speed your game play goes for a toss. Without Game play - well err... I guess everyone understands.
I never said C++ sux or otherwise... I only said C style coding is good.

#14 hanzac

    New Member

  • Members
  • PipPip
  • 23 posts

Posted 26 July 2003 - 10:46 AM

i like c as well ... i can do whatever i want to do even oop
-- <span style='color:red'>Flame.Light()</span> --

#15 baldurk

    Senior Member

  • Members
  • PipPipPipPip
  • 1057 posts

Posted 27 July 2003 - 08:38 AM

OO in pure C? I'd like to see that.
baldurk
He who knows not and knows that he knows not is ignorant. Teach him.
He who knows not and knows not that he knows not is a fool. Shun him.

#16 davepermen

    Senior Member

  • Members
  • PipPipPipPip
  • 1306 posts

Posted 27 July 2003 - 12:55 PM

oop is nothing magic. its simply much nicer to do in c++ than in c..

but if you want to use templates, you would have to code a preprocessor to preprocess your files before c to implement it..

there is no way to do them in c, except writing the code manually for all different possible types:D


and oop is not slow actually. really not. compilers are aware that people will use it and that they want it fast..:D
davepermen.net
-Loving a Person is having the wish to see this Person happy, no matter what that means to yourself.
-No matter what it means to myself....

#17 hanzac

    New Member

  • Members
  • PipPip
  • 23 posts

Posted 27 July 2003 - 01:23 PM

davepermen:
i have the same feeling with you,
actually when i want to do something like template in c, i just use the pointer
and give the number of bytes and pass the pointer. maybe it is not a convenient way. i like it, and i am just trying to learn.

maybe in real project i will choose c++ or above. :rolleyes:
-- <span style='color:red'>Flame.Light()</span> --

#18 davepermen

    Senior Member

  • Members
  • PipPipPipPip
  • 1306 posts

Posted 27 July 2003 - 01:41 PM

the pointer is less efficient in some situations (ints,floats,etc..), and does not give the same power at all that templates give you:D
davepermen.net
-Loving a Person is having the wish to see this Person happy, no matter what that means to yourself.
-No matter what it means to myself....

#19 hanzac

    New Member

  • Members
  • PipPip
  • 23 posts

Posted 27 July 2003 - 02:08 PM

maybe i have another advantage:

it is dynamic and the template is static once it is compiled. :D
-- <span style='color:red'>Flame.Light()</span> --

#20 davepermen

    Senior Member

  • Members
  • PipPipPipPip
  • 1306 posts

Posted 27 July 2003 - 03:20 PM

just depends on what you need.. but templates can generate your "dynamic code" as well:D just give them in a pointer:D
davepermen.net
-Loving a Person is having the wish to see this Person happy, no matter what that means to yourself.
-No matter what it means to myself....





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users