Thread: Skipping part of the code.

  1. #16
    Registered User
    Join Date
    Oct 2008
    Posts
    65
    well I stumbled on a problem today with mixing c and c++..
    dont want to know how many that will be in 4 years ^^

    So you suggest that I pick up c++ instead? or keep learning some "basics" in c?

  2. #17
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    I suggest you learn the language you want to know (I'd recommend C++ myself, of course).
    Even if you learn C++, you'll still learn the basics, don't worry.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #18
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    I don't think the issue is over your convention of programming. I think the problem is that you are using the C++ STL within the context of a "C" program. In other words, you are doing a C++ only thing in a C program. Ergo, your program is a C++ program.

    C++ is different in that it allows one to write classes, inherit traits between objects, gives a more type-bound coding structure, and allows templates to be written (That is a very broad comparison, so please spare everyone pointless flaming that is just a narrowing of my description).

    C++ is a different language. Would you think it odd if I had code like this:

    Code:
    float quadratic(float a, float b, float c, bool plus)
    {
      float descr := b*b - 4*a*c;
    
      quadratic := (plus)?(-b+sqrtf(descr))/(2*a):(-b-sqrtf(descr))/(2*a);
    }
    You would be like dude, what is that? Some sort of crazy PASCAL, VB, C hybrid? Remember you can use C within a C++ program, but not the other way around.

  4. #19
    Registered User
    Join Date
    Oct 2008
    Posts
    65
    Well if the diff. on c and c++ is so huge, why sit hours with that when in the long run I will get out more of c++?

    or am I out on a road beyond my knowledge and understanding now? :P

  5. #20
    Registered User
    Join Date
    Oct 2008
    Posts
    65
    ye wtf is that master 5001 ^^

  6. #21
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by And3rs View Post
    Well if the diff. on c and c++ is so huge, why sit hours with that when in the long run I will get out more of c++?
    Yeah, I ask myself the same thing.
    But seriously, it depends on the target platform. Embedded systems, unfortunately, still are pretty much only C today.
    But if you intend to target the PC/Mac market, then I would definitely say that C just won't cut it and C++ is the one for the job.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  7. #22
    Registered User
    Join Date
    Oct 2008
    Posts
    65
    well, first.. what is a embedded system?
    Too bad I bought books on c programming today then.

  8. #23
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Embedded systems are those things often integrated into various electronic devices?
    Your DVD player, your digital camera, your mp3 player, etc.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  9. #24
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    My point is simply, if you are writing in one language you typically do not arbitrarily introduce another at will. With C++ and C it is slightly since C++ is based on C. However you are clearly intending to write a C program.

  10. #25
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    I use C++ in embedded systems too... Though it depends on what sort of device it is. I personally tend to be more of a C kind of guy. Though its all the same to me. I will use whatever gets the task completed the swiftest. Even if its a tool I wrote in PHP or Python or whatever.

  11. #26
    Registered User
    Join Date
    Oct 2008
    Posts
    65
    Now I understand why my friend is using C, he is working for some company that is working with dvd's etc.

    well now I´m just confused, use c or c++.
    I started off with c++ in the beginning, but then I got told to do some C, dunno why really.

  12. #27
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    I thought this might happen.
    OK, what I proposed was - choose the language depending on what you want to do.
    Do you want to work with mostly embedded systems (most embedded systems are C, some are C++, and some are just assembly)? If so, then you will probably have to learn C, and possibly C++ if any embedded systems you will work on will be using that.
    Or maybe you want to work with computer software? If so, choose C++.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  13. #28
    Registered User
    Join Date
    Oct 2008
    Posts
    65
    Well my goal is to work with computer software, so I supose I will go C++.

    well the things I have learnt from C will not go to waste, some things is still the same. Or very alike

  14. #29
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Yes, they are. C++ is backwards compliant, except it's a little stricter. But C++ is also based on C, but providing more tools, so the C grounds is something you will use in C++, too.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  15. #30
    Registered User
    Join Date
    Oct 2008
    Posts
    65
    Then I have one more question.

    c++ for dummies 2nd edition and so on, is it any changes on the editions?
    I know there is like 7 pages on books, just maybe it is faster to ask here

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Code writing issues Part 2...
    By jaybo684 in forum C++ Programming
    Replies: 10
    Last Post: 08-01-2005, 08:28 AM
  2. Problem : Threads WILL NOT DIE!!
    By hanhao in forum C++ Programming
    Replies: 2
    Last Post: 04-16-2004, 01:37 PM
  3. Seems like correct code, but results are not right...
    By OmniMirror in forum C Programming
    Replies: 4
    Last Post: 02-13-2003, 01:33 PM
  4. Replies: 4
    Last Post: 01-16-2002, 12:04 AM