Any reason to use C?

Started by
17 comments, last by Russell 20 years, 9 months ago
all of my new hobbyist Windows stuff is OOP-style C++, or more recently templated classes. but all of my old Windows stuff and all of the Unix stuff i get paid for now is in ANSI C, even the new code (mostly embedded SQL related.) but most of that''s just because i''m very comfortable with the coding style i use for that language. i could just as easily use some of the C++ functional extensions if i didn''t want to do OOP style C++ though, but i don''t. it''s just force of habit i guess.

if C were to die today i wouldn''t miss it since I still could create "terse" code using C++. and to me that''s always been one of the strengths of C. but i know times change so i''m slowly changing with them.
Advertisement
and knowing C might just land you a job in this tight job market, whereas only knowing C++ might not. i know it''s not likely these days but what if all you knew was STL instead of STL and stdio and stdlib and ...? it could potentially make the difference between you and a competitor, assuming you would want the job in the first place. i know some highly paid people who do nothing but support legacy code written in COBOL, RPG, C, FORTRAN, MUMPS, etc. and when it comes time to migrate the code to a newer language they get free training to boot. assuming they just don''t out source the work off shore instead.

i think it''s much like knowing Latin. might not get you anywhere, and you more than likely will never use it, but it looks good on a CV/resume.
I personally still use some aspects of C when coding, even though I''m doing OO C++ for the most part. Formatting strings is one big example--I know that you can, eventually, mangle strstream into formatting appropriately, but sprintf will do it in one line of code. I don''t know of an equivalent to strncpy, though I''m sure I could kludge one together. Same with most of the other strn* functions.

Of course, if I''m just mangling strings, I much prefer perl--with its regular expressions, . and + operators, strings are very easy to play with. But that''s beside the point.

-Odd the Hermit
Majority of windows apps use MFC thus use C++. D3D can be used within C and win32 but I don''t recommend it. Even embedded world is using C++ nowdays because processors got cheaper and faster and appliances got more complex. Actually, the world is moving towards Java/.net and away from C++ for most apps. Games are niche markets where C++ is used more so than other langs. One thing is certain and that OOP is going to be in future langs. I hear C# will get updated with C++ feature set down the road. I think Java also will get templates.
quote:Actually, the world is moving towards Java...
Oh god no...I like OOP to a certain degree, and then some of the things just become major overkill for 99% of things that need to be done. I think Python would be a much better place to move towards than Java.
i''m always curious where these guys who make such definitive statements in their posts get their info from. JD, could you please site some sources of reference to back up your assertions? especially this one: "Actually, the world is moving towards Java/.net and away from C++ for most apps." where did you read this? was it on-line or in writing? perhaps in a peer-reviewed periodical? were there statistics shown along with the statement? was this a global sampling? how large was the sample? any other statistical info would be helpful.

there''s several other in there i would like links/references for as well, if you wouldn''t mind? thanks.
there''s a difference between using C, and using C paradigms.

nothings wrong in using c-style features, like functions, and such, in c++ as well. you can use it there, unlike in java for example. so use your c programming knowledge where it suits your needs..

but on any platform with a decent c++ compiler there is no reason to use C as language. C++ can do what C does with minor differences, and can add a lot of other features, too.

there is no reason to use C as programming language anymore, except because it''s the only language of choise, or legacy support of a c programmed product.

there IS reason to use what you learned in C to program with that knowledge in C++, too. you can still use structs, you can till use functions. so use''em where they''re useful

"take a look around" - limp bizkit
www.google.com
If that's not the help you're after then you're going to have to explain the problem better than what you have. - joanusdmentia

My Page davepermen.net | My Music on Bandcamp and on Soundcloud

Because you have idiots at work who don''t want to use C++.
quote:
Original post by nickwinters
O''Caml???!?!?!?! Please, tell me you''re joking...


Ahahaahahaa yes. I. am. joking.

No, OCaml certainly has it''s issues, this project is very much a ''proof of concept'' but based on some other work, I''m convinced it will (or at least can) work well. I''m happy to sacrifice a slight performance decrease in certain sections (and the actual renderer/engine code divide isn''t fixed yet) for benefits including type inference, serious polymorphism, reduced development time etc. In fact, the biggest headaches I''ve currently got are:

i) making sure the GC doesn''t start getting in the way
ii) how to integrate Lua without amassing an enormous C->OCaml->C->Lua->C->... sequence although I''m sure most of it can be generated anyway.

I''d have been happier if you''d asked me if I was joking in using Direct3D

This topic is closed to new replies.

Advertisement