Thread: Converting from C to C++

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    2,158
    Why do this?
    Most compilers allow you to compile C and C++ files in the same project (program), at the same time.

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    As discussed, it depends on how far you want to take it. The difficulty ranges from "renaming the file" (and fixing any compiler errors that crop up) to "making the application entirely object oriented".

    One thing that comes to mind is to use the STL containers (e.g. list) instead of using your home-made linked list system.

    I don't think there is much point in ONLY replacing malloc with new and free with delete - malloc and free are still valid C++ code as long as there is no need to construct an object from the pointer.

    In an ultimate made object oriented, you'd have a packet object and a messagenode object which you can manipulate through member functions. That would be essentially a complete rewrite of the code.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Converting 32 bit binary IP to decimal IP (vice-versa)
    By Mankthetank19 in forum C Programming
    Replies: 15
    Last Post: 12-28-2009, 07:17 PM
  2. Tips for converting C prog. to C++?
    By eccles in forum C++ Programming
    Replies: 7
    Last Post: 01-15-2005, 07:38 AM
  3. Converting Sign Magnitude Integer Binary Files
    By Arthur Dent in forum C Programming
    Replies: 7
    Last Post: 09-13-2004, 10:07 AM
  4. Converting from Screen to World Coordinates
    By DavidP in forum Game Programming
    Replies: 9
    Last Post: 05-11-2004, 12:51 PM
  5. converting string to float
    By twhubs in forum C Programming
    Replies: 1
    Last Post: 09-16-2001, 09:02 AM