Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: Is it okay to use C in C++ code

  1. #1
    Join Date
    Feb 2011
    Location
    Great White North
    Beans
    128
    Distro
    Kubuntu 11.10 Oneiric Ocelot

    Question Is it okay to use C in C++ code

    I know that C code can mostly be used (some exceptions) in C++ code. I'm joining a local robotics team which uses C++ to code their robots.

    Do you think it will be okay if I use C code because I'm used to it instead of C++ code (Which I never learned), and just use C++ code for parts where they use classes? Would it make a speed difference using C functions instead of C++ functions?


    Any opinions would be helpful.
    VHDL and C FTW

    Designing a custom CPU based on MIPS

  2. #2
    Join Date
    May 2006
    Beans
    1,790

    Re: Is it okay to use C in C++ code

    Quote Originally Posted by alegomaster View Post
    I know that C code can mostly be used (some exceptions) in C++ code. I'm joining a local robotics team which uses C++ to code their robots.

    Do you think it will be okay if I use C code because I'm used to it instead of C++ code (Which I never learned), and just use C++ code for parts where they use classes? Would it make a speed difference using C functions instead of C++ functions?


    Any opinions would be helpful.
    The important thing is probably what the rest of the team think about it. I suppose that you won't be able to avoid looking at and understand their C++ code.

  3. #3
    Join Date
    Feb 2011
    Location
    Great White North
    Beans
    128
    Distro
    Kubuntu 11.10 Oneiric Ocelot

    Re: Is it okay to use C in C++ code

    Quote Originally Posted by Arndt View Post
    The important thing is probably what the rest of the team think about it. I suppose that you won't be able to avoid looking at and understand their C++ code.
    True, but if I write code, I would better off be with C because I know more about it, but I could try to teach myself C++.

    On a side note does anybody know a good free online book about learning C++. I am getting a Pocketbook 902 so I could read the book on there.
    VHDL and C FTW

    Designing a custom CPU based on MIPS

  4. #4
    Join Date
    Dec 2008
    Location
    Deep Woods of PA
    Beans
    699
    Distro
    Kubuntu 11.10 Oneiric Ocelot

    Re: Is it okay to use C in C++ code

    Quote Originally Posted by alegomaster View Post
    Do you think it will be okay if I use C code because I'm used to it instead of C++ code (Which I never learned), and just use C++ code for parts where they use classes?
    That would be a good question to ask the team this question.

    Would it make a speed difference using C functions instead of C++ functions?
    Any opinions would be helpful.
    I don't know if C code will make any speed difference in the code you write. You can write code in C that will not perform well and C++ that performs decently and vice versa.
    Regards,

    Karlson

  5. #5
    Join Date
    Dec 2008
    Location
    Deep Woods of PA
    Beans
    699
    Distro
    Kubuntu 11.10 Oneiric Ocelot

    Re: Is it okay to use C in C++ code

    Quote Originally Posted by alegomaster View Post
    On a side note does anybody know a good free online book about learning C++. I am getting a Pocketbook 902 so I could read the book on there.
    http://www.amazon.com/Accelerated-C-...5258539&sr=8-1
    http://www.amazon.com/Effective-Spec...ref=pd_sim_b_1
    http://www.amazon.com/More-Effective...ref=pd_sim_b_1

    Start with these
    Regards,

    Karlson

  6. #6
    Join Date
    Feb 2011
    Location
    Great White North
    Beans
    128
    Distro
    Kubuntu 11.10 Oneiric Ocelot

    Re: Is it okay to use C in C++ code

    I need a free online book, because I don't have enough money for them, and I dont have any interest in C++ other then the robotic team.

    I found a free online book for using GAS, there must be something on C++.
    VHDL and C FTW

    Designing a custom CPU based on MIPS

  7. #7
    nmaster is offline Extra Foam Sugar Free Ubuntu
    Join Date
    Jun 2009
    Beans
    718

    Re: Is it okay to use C in C++ code

    define "book"... i'm sure what a "Pocketbook 902".

    you could try this:
    http://www.howtoforge.com/learning-c...s-step-by-step

  8. #8
    Join Date
    Sep 2009
    Location
    Canada, Montreal QC
    Beans
    1,809
    Distro
    Ubuntu 11.10 Oneiric Ocelot

    Re: Is it okay to use C in C++ code

    Try reading the official C++ tutorial first. It gives you a good introduction over its capabilities and concepts. That might be all you need to program robotics.
    I know not with what weapons World War III will be fought, but World War IV will be fought with sticks and stones.
    Freedom is measured in Stallmans.
    Projects: gEcrit

  9. #9
    Join Date
    Feb 2011
    Location
    Great White North
    Beans
    128
    Distro
    Kubuntu 11.10 Oneiric Ocelot

    Re: Is it okay to use C in C++ code

    Quote Originally Posted by cgroza View Post
    Try reading the official C++ tutorial first. It gives you a good introduction over its capabilities and concepts. That might be all you need to program robotics.
    What is the official C++ tutorial
    VHDL and C FTW

    Designing a custom CPU based on MIPS

  10. #10
    Join Date
    Jun 2007
    Location
    Maryland, US
    Beans
    6,288
    Distro
    Kubuntu

    Re: Is it okay to use C in C++ code


Page 1 of 2 12 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
  •