John Carmack - C/asm

Started by
47 comments, last by ao 23 years, 10 months ago
Using non-ANSI features of your C compiler means your code is no longer as easily portable surely, in which case what is the point of having a standard?

Edited by - simon_brown75 on June 19, 2000 2:15:03 PM
Advertisement
quote:Original post by David M.
Well...that''s all, I suppose. Sorry if that sounded like an angry rant--it''s just that I''ve become a bit high-strung from having so many people criticize my "stone-age" methods--people who don''t even know what inheritance *is*. (I''m not saying you''re an instance of this class--I know you''re not.)


I was about to post an indignant reply until I read that last part .

If you manage to do inheritance, polymorphism and operator overloading using just C, that''s fine with me. In fact, it shows that you know how to get the most out of your language, and if I were a recruiter, that would matter to me, a LOT. It''s important to know your possibilities, and what your language will or will not do. Object Oriented programming is not a holy grail, nor a magic potion to make all your coding easier. It is a tool, like any other.
Personally, I think templates are much more useful, specially in high-performance graphics. My class hierarchies are usually terribly shallow, with pure virtual classes at the base, adding no overhead while taking advantage of polymorphism. It''s just the way I use it.




Give me one more medicated peaceful moment..
~ (V)^|) |<é!t|-| ~
It's only funny 'till someone gets hurt.And then it's just hilarious.Unless it's you.
Madkeith,
hey calling COM objects in C isn''t really a pain in the arse. You just need to add a reference to the lpVtbl and add the object to the first argument in the functions. Oops, that is a pain in the arse ;P

On the topic of COM, is it possible to write COM objects in C? Are there any tutorials for this?

========================================================
If something sounds stupid but works, it's not stupid
==========================================In a team, you either lead, follow or GET OUT OF THE WAY.
COM is possible in any language (theorectically) and if you read Inside DirectX it is written mostly in C, so it is definitely possible, though I dont have any links.

-----------------------------

A wise man once said "A person with half a clue is more dangerous than a person with or without one."
-----------------------------A wise man once said "A person with half a clue is more dangerous than a person with or without one."The Micro$haft BSOD T-Shirt
I would really like the article also.
Thanks,
Wrenhal
wrenhal@visto.com
quote:Original post by XBTC

Hey could you send me the articel,too?
Would be very nice,XBTC!

P.s.:For my email-adress just click on the who? button.(In case you don´t know already)


BeSIt's Da BOMB Baby!!!. o O ~ A little nonsense now and then,is relished by the wisest men~ O o .-- Willy Wonka
It is NOT possible to write COM objects in c, although you can call them from c. According to Microsoft "COM is designed primarily for C++ and Microsoft Visual Basic® developers." If you look at what you need to do to write one without using ATL or MFC (both of which rely on c++, btw) it''s pretty tough. All sorts of good shit in there. You can''t even use COM from c, what you are doing is accessing the object through interfaces. Take a look in the MSDN COM tutorial and you''ll see what I mean.

Good or bad, there is a lot of stuff that you simply cannot do anymore with c. If you are a serious Windows programmer, you''re headed down the c++ route sooner or later. ActiveX and a bunch of other shit require it, especially since it seems that Microsoft wants to compete with JAVA.

-BacksideSnap-
Wholy smokes, this thread is turning into what I hoped it wouldn''t when I requested that info. Oh well, I hope somebody is learning something from all this

ao
Um, this is progressing into a flame war. I hope this is deleted so I do not have to get out my aerosol and match.

-----------------------------

A wise man once said "A person with half a clue is more dangerous than a person with or without one."
-----------------------------A wise man once said "A person with half a clue is more dangerous than a person with or without one."The Micro$haft BSOD T-Shirt
MadKeithV--I've never used templates or anything like that. I just tried using classes for my interfaces once, and...well, I wasn't all that impressed, to say the least. I couldn't see how I was stepping into the "next phase" of programming, as my peers like to shove down my throat. When I say I hate C++, you see--I do say it sometimes, though it's usually unwise--I suppose I mean that I hate the attitude it tends to create in some people. It's just like I hate the attitude that Christianity tends to create in some people. (I'm a Christian, but I can't stand any Christians other than family and my girlfriend.)

What really bugs me, as I've probably said before, is when people tell me there are things I just "can't do" in C Classic. They like to tell me that they're technologically "ahead" of me. Well, pffft, I say. If I knew raw machine language better than they knew C++, I could write better programs than they could. That is, I believe that `smart programmer' trumps `smart language' every time. So, if someone's program is better than mine, I don't care if they used COBOL, even. It would still be better, no matter how you sliced it. Users don't care what language was used, do they? I don't think they do.

Now, another thing I don't like is having all my private functions and variables in the header file. I prefer to have the interface in the header file, and the implementation in the C file. I don't know why, exactly--it's just a, um, snobby aesthetic thing of mine.

Finally, I don't like it when people twist OOP and C++ to mean the same thing. *Yes*, OOP is the right way to write code, but it doesn't necessarily mean using C++. (It doesn't always mean inheritance, either.) OOP is just about making the code and data cohesive, right? Maybe some people find it easier to use C++ for OOP, but I feel that C is just as easy--for what I do, anyway.

So...I'm just letting off some steam. This issue has been hanging with me ever since I started programming in C (three years ago, when I was twelve), and it's starting to show.

Edited by - David M. on June 20, 2000 10:51:38 PM
I started programming in C/C++ about 5 years ago now, when I was 19. So it''s not like you''re an exceptionally late starter or anything .

Some points:
1. I''m a Catholic, so be careful what you say about Christians and not liking em.

2. C++ is a HARD language. Anyone who claims anything else does NOT know C++, they only think they do. C++ is hard in the way that Assembler is easy. Assembler is straightforward, you know what it does, you can predict execution time reasonably well by just inspecting the code. With C++, a single line can imply hundreds of others, or perhaps it''s just a single line.
It''s taken me five years to become confident enough to say that 90% of the time, I know most of the hidden code that gets generated for the code I write myself.

3. There is indeed nothing inextricably linking OO and C++. C++ happens to have support for some OO-type constructs. That''s as far as you can stretch it. The inability to hide private members so that they are not visible from header files is shortcoming in my eyes as well. All books claim your .h file is the "interface", but it isn''t, it''s the declaration of your class, and therefore a superset of the interface.
Yes, you CAN simulate it using inheritance from abstract base-classes that implement the actual interface, but a) that''s not clean enough to call it a solution, it''s more of a hack, and b) most of the time, it can introduce a lot of unnecessary overhead if you''re not careful about the implementation.

4. A good program is a good program, in whichever language. Someone asked me yesterday if VB was a "good" language to program games in. I said, definately, depending on the kind of game it is and the kind of programmer you are. Some people will make fun games in little time with little experience in VB, and some people will make bad games in a long time while they have a LOT of experience in C++ ( Yes John Romero, I DO mean you ).
It depends on the programmer, the circumstances, the idea, and the target.

Use what you need to get to your target, and no more, no less.
That''s really all that matters.


Give me one more medicated peaceful moment..
~ (V)^|) |<é!t|-| ~
It's only funny 'till someone gets hurt.And then it's just hilarious.Unless it's you.

This topic is closed to new replies.

Advertisement