Page 2 of 10 FirstFirst 1234 ... LastLast
Results 11 to 20 of 91

Thread: Is C as bad as everyone says C++ is?

  1. #11
    Join Date
    Jan 2006
    Beans
    1,237
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Is C as bad as everyone says C++ is?

    C and C++ are two of the most powerful programming languages that exists today. So I wouldn't believe what they say about C++.

    If you really want some examples, %99 of linux (kernel) is made of pure C.
    Most of the 3D mainstream games such as quake4, doom3, crysis etc... are made of C++. So you see, these are huge and important projects. I don't think they would use C or C++ if they were "messy/frustrating/etc"

    if you want to learn some low level stuff C is the way to go. I started with C years ago and I still use it as my main language.

  2. #12
    Join Date
    Aug 2006
    Location
    60°27'48"N 24°48'18"E
    Beans
    3,458

    Re: Is C as bad as everyone says C++ is?

    Quote Originally Posted by dribeas View Post
    Those are comments out of prejudice and not really knowing the language. On the other hand learning C++ is harder and takes more time than most other languages.
    The latter sentence really sort of proves the complaints about C++... if a language is particularly hard to learn and takes more time to use right than other languages, something is wrong with the language, IMO. I personally feel my own reservations about C++ really don't come from not "properly knowing" the language -- my exposure to C++ has been sufficient for me to decide that I really see no reason to "properly know" all the stuff I need to know to be a (really professional-level) competent C++ coder.

    Quote Originally Posted by cb951303 View Post
    C and C++ are two of the most powerful programming languages that exists today. So I wouldn't believe what they say about C++.
    How do you define "power"? We've had these discussions a lot on this forum... there seems to be this strange belief that the closer to the machine you are, the more powerful a language is, which completely disregards expressive power, the ability to conceptualize effectively in the language.

    If you really want some examples, %99 of linux (kernel) is made of pure C.
    Most of the 3D mainstream games such as quake4, doom3, crysis etc... are made of C++. So you see, these are huge and important projects. I don't think they would use C or C++ if they were "messy/frustrating/etc"
    The reason why kernel uses C is hardware interfacing and low-level resource management, which is what kernel is really there to do in the first place -- so what you want is a syntactic sugar layer on top of assembly, essentially. Other reason is runtime speed, why 3D mainstream games use C++ which further gives you the OOP stuff.

    The same runtime speed advantages are achievable in most other languages which compile to native, and I can easily see a lot of them being "cleaner" as languages than C++ is. Interestingly, these days a lot of non-native-compiled languages can handle 99% of your codebase in a lot more higher-level way...
    Last edited by CptPicard; September 21st, 2008 at 05:47 PM.
    LambdaGrok. | #ubuntu-programming on FreeNode

  3. #13
    Join Date
    Jan 2006
    Beans
    1,237
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Is C as bad as everyone says C++ is?

    Quote Originally Posted by CptPicard View Post
    How do you define "power"? We've had these discussions a lot on this forum... there seems to be this strange belief that the closer to the machine you are, the more powerful a language is, which completely disregards expressive power, the ability to conceptualize effectively in the language.
    you're mistaken me with a C/C++ fanboi. I didn't say they were the only powerful ones.

    The reason why kernel uses C is hardware interfacing and low-level resource management, which is what kernel is really there to do in the first place -- so what you want is a syntactic sugar layer on top of assembly, essentially. Other reason is runtime speed, why 3D mainstream games use C++ which further gives you the OOP stuff.
    I'm well aware of what you stated here however it only proves that C is a powerful language

    The same runtime speed advantages are achievable in most other languages which compile to native, and I can easily see a lot of them being "cleaner" as languages than C++ is. Interestingly, these days a lot of non-native-compiled languages can handle 99% of your codebase in a lot more higher-level way...
    than why the big gaming companies like EA, ID Software, Blizzard etc. chose C++ over your cleaner native compiled languages...

    I understand that there are other languages, very powerful ones. But bashing C or C++ is just ridiculous since they are very popular languages. In fact according to this C/C++ is the number 1 and 2 most popular native compiled languages.

  4. #14
    Join Date
    Aug 2008
    Beans
    Hidden!

    Re: Is C as bad as everyone says C++ is?

    Quote Originally Posted by cb951303 View Post
    I'm well aware of what you stated here however it only proves that C is a powerful language
    As a matter of fact, it proves that you can exert a very fine level of control over how the processor runs your program. With other languages, you can conduct thousands of instructions with one fell swoop, if that's the expression I'm looking for.

    Which is more 'powerful' in the sense you're looking for, the tweezer or the bulldozer?

  5. #15
    Join Date
    Jan 2006
    Beans
    1,237
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Is C as bad as everyone says C++ is?

    Quote Originally Posted by pp. View Post
    As a matter of fact, it proves that you can exert a very fine level of control over how the processor runs your program. With other languages, you can conduct thousands of instructions with one fell swoop, if that's the expression I'm looking for.

    Which is more 'powerful' in the sense you're looking for, the tweezer or the bulldozer?
    why is that the word powerful bothers you so much? having control over how processor runs is a powerful side of C.

    bad analogy BTW, you can tell which one is more powerful by looking their specs.

  6. #16
    Join Date
    Aug 2006
    Location
    60°27'48"N 24°48'18"E
    Beans
    3,458

    Re: Is C as bad as everyone says C++ is?

    Quote Originally Posted by cb951303 View Post
    I'm well aware of what you stated here however it only proves that C is a powerful language
    It just proves that it is a good technical fit for purpose in that case, for some specific reasons present in these particular application domains.

    than why the big gaming companies like EA, ID Software, Blizzard etc. chose C++ over your cleaner native compiled languages...
    Popularity is a weak argument because of the way Sturgeon's law applies to software developers.

    Of course, the fundamental reason here still is just runtime speed advantage, and that edge is fast eroding.

    I am not in general a huge fan of any C-derivative, and not a C++ fan in particular because of the excess complexity and huge amount of "language quirks" and OO design you must master to get anything out of the language. For a decent attempt at ironing out C++'s issues, look at the D language...

    I understand that there are other languages, very powerful ones. But bashing C or C++ is just ridiculous since they are very popular languages.
    It's not ridiculous if there are good reasons to see C++ as a bloated monstrosity...
    LambdaGrok. | #ubuntu-programming on FreeNode

  7. #17
    Join Date
    Jan 2006
    Beans
    1,237
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Is C as bad as everyone says C++ is?

    Quote Originally Posted by CptPicard View Post
    It just proves that it is a good technical fit for purpose in that case, for some specific reasons present in these particular application domains.
    thus very powerful in that domain.

    Popularity is a weak argument because of the way Sturgeon's law applies to software developers.
    actually it's not weak since there is a reason its so popular.

    Of course, the fundamental reason here still is just runtime speed advantage, and that edge is fast eroding.
    it's like your saying c++ is not powrful but in some areas its very good. I don't understand your logic.

    I am not in general a huge fan of any C-derivative, and not a C++ fan in particular because of the excess complexity and huge amount of "language quirks" and OO design you must master to get anything out of the language. For a decent attempt at ironing out C++'s issues, look at the D language...
    well its just not enough to bash c++. its bigger than that.

    It's not ridiculous if there are good reasons to see C++ as a bloated monstrosity...
    have I in any way stated that C++ is a perfect language? Which language is perfect? D? Again it's just not good enough reason to bash C++.

  8. #18
    Join Date
    Apr 2007
    Location
    (X,Y,Z) = (0,0,0)
    Beans
    3,715

    Re: Is C as bad as everyone says C++ is?

    Quote Originally Posted by Tux0r View Post
    As said before C is very compact, I made this image to make you understand (small amount of keywords makes it harder to do stuff).
    Sorry, you missed one: the mythical "entry" keyword : never implemented, never defined and nobody ever knew what it was meant to be...

    But, about the topic:

    You want us to compare two languages that, even if they are very related, have almost the same syntax, but exactly the same "look-and-feel", are two different languages. Yes, C++ was initially an extension to C, but now it isn't.

    I don't know any C++, so I won't comment on it.

    C is a very tiny language, the next step in the "Abstraction scale" after Assembly, it just gives you some data types (that actually are just memory chunks of different sizes), a way to combine data types into more complex ones (struct), control flow and I just can't think of any other feature C has... because it doesn't need it for what it was meant for. If you code in C and begin to miss polymorphic OOP, lambda closures or some document formatting mark-up like XML, you're using the wrong language, even if you can write C code to implement those things... and therefore, waste a lot of time in creating extensions to C for a problem you just could do easily on a higher-level language.

    If you use C for what is meant to: i.e kernels, drivers, low-level libraries, system utilities that can't depend on an interpreter(like a shell), etc. C's simplicity and low-levelness are an advantage as they give the computer less stuff to process and also some shortcuts to control computer resources more efficiently (something you definitely want for your super-new-brand kernel).

    But, outside that, C's simplicity becomes a burden, unless you start making extensive usage of external libraries just to get things other languages already have (e.g. using GLib to have a list data type, when Python has a native one), or worse, you don't even look what libraries there are and start coding everything by yourself.

    Higher-level languages, and that includes C++, which is definitely higher-level than C, have more expressive power... but usually at the cost of runtime speed. Your language choice should depend on what you need or want... If you want extreme expression in order to talk about "dogs", "cakes" and "eating" in your program, go for Lisp... and eventually you can have "cake-eating dogs" in your program. If you want to run at lightspeed, use Assembly or C... If you need speed and some object abstraction, there you have C++.

    If your problem involves stuff not specific to the computer internals, then avoid C. If you need access to that stuff, use it and avoid anything else.

  9. #19
    Join Date
    Nov 2007
    Beans
    706
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: Is C as bad as everyone says C++ is?

    Quote Originally Posted by cb951303 View Post
    why is that the word powerful bothers you so much?
    It's because 'powerful' can be defined in more ways than one. When you say 'powerful', you seem to imply that the more lower-level access you have to the machine, the more 'powerful' you become. However, when experienced programmers (with perhaps degrees or jobs - those experienced by age) speak of power, they usually mean in terms of the most efficient way to get things done.

    Hacking in C/C++ does not necessarily make you a more 'powerful' programmer. C is used where low-level access is required, like in our precious kernel. C++ is used in large projects, where abstract methods are required to keep the programmers sane, and also because it was the first of it's paradigm to gain popularity in the 80's and 90's. Because of the (very) large amount of people who jumped on that bandwagon, it's still used a lot today, though less and less.
    Programming is an art. Learn it. Live it. Love it.

  10. #20
    Join Date
    Aug 2006
    Location
    60°27'48"N 24°48'18"E
    Beans
    3,458

    Re: Is C as bad as everyone says C++ is?

    Quote Originally Posted by cb951303 View Post
    thus very powerful in that domain.
    Runtime speed advantage is a marginal benefit if the rest of the language is nasty to code in...

    actually it's not weak since there is a reason its so popular.
    As I said, Sturgeon's law says 90% of developers are crap, so therefore, they're wrong and satisfied to just use whatever is handed to them (this is valid in somewhat different sense for Java and C#). If they were right, we could just agree to use C++ for all eternity and forget about all our further language development efforts

    The saddest part is that they're spending their intellectual resources in misguided attempts to manage C++ instead of managing the problem (or maybe writing a language from scratch with all the cruft and baggage thrown out).

    it's like your saying c++ is not powrful but in some areas its very good. I don't understand your logic.
    No, I am not saying that C++ is "very good" at anything -- being a mediocre middle ground solution in a lot of stuff is in some sense why it's popular and why it's not "great". It seems to somehow get the job done in OOP modelling sense and gives decent performance, but that still doesn't make it forgivable that you need to master endless amounts of C++-specific minutiae not to trip up with the language.

    well its just not enough to bash c++. its bigger than that.
    It is interesting how criticism is to be taken as "bashing" when there is an urgent need to ignore the criticism.

    have I in any way stated that C++ is a perfect language?
    No, and you never needed to say that to cause me to state that it is too troublesome for what it's worth.

    Which language is perfect? D?
    Well, Lisp does come close...
    LambdaGrok. | #ubuntu-programming on FreeNode

Page 2 of 10 FirstFirst 1234 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •