Thread: C or C++

Page 1 of 2 12 Last
  • Jump to page:
    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Location
    Sydney, NSW, Australia
    Posts
    40
    Rep Power
    15

    C or C++


    Hi,

    I am a first year uni student. I can Program in Perl and PHP currently, however I would like to move into the area of

    1) Developing windows applications in C or C++.
    2) Developing CGI applications/Apache modules in C or C++.

    I have not started to learn this languages yet, however I am not sure which one I should learn. My understanding is that they are both similar, but C++ allows object orientated programming.

    Is C a good language to learn for the objectives I wrote above, or is C++ more suited to this? Any advice and/or reasons would be greatly appreciated. Thanks in advance.
    Cheers,
    Michael Bray
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2001
    Posts
    34
    Rep Power
    14
    Learn C first. As everything that you know from C will be able to be used in C++. Have some experience with Java too, so learning C++'s OO will be an easier experience.
  4. #3
  5. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2001
    Location
    USA
    Posts
    286
    Rep Power
    13
    1) C++. Once you learn C++, you can use MFC to create windows apps. You can also use straight C to interact with the Windows API, but that's overkill. But as said before, you should learn C first. C++ is a superset of C.
    2) Sorry, never done any of this.
    Jon Sagara

    "Me fail English? That's unpossible!"
  6. #4
  7. No Profile Picture
    Not there when you need me
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Oct 2001
    Location
    Berlin, Germany
    Posts
    1,430
    Rep Power
    15
    2) CGI: whatever language you want, so long as it can do input and output. Both C and C++ are OK, although I find C++ better for this (never done it myself, though). It's the difference between
    Code:
    printf( "Content-Type: text/html\n\n<html>..." );
    and
    Code:
    cout << "Content-Type: text/html" << endl << endl << "<html>...";
    (I'm not sure if that's correct at all.)

    Apache mods: they seem to be C, but you'll want to take a look at the docs.
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Location
    Sydney, NSW, Australia
    Posts
    40
    Rep Power
    15
    Thanks for your advice. Just another quick question related to this topic, is C# a better pathway to take then C++ is after I have got my head around C?

    I have to admit, C# seems to have come out of no where and now all of a sudden I am seeing it alot. I have no idea how it differs from other variants, so any info on that would be greatly appreciated as well.
    Cheers,
    Michael Bray
  10. #6
  11. No Profile Picture
    Not there when you need me
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Oct 2001
    Location
    Berlin, Germany
    Posts
    1,430
    Rep Power
    15
  12. #7
  13. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2001
    Location
    USA
    Posts
    286
    Rep Power
    13
    If performance matters, then go with C++. C# is slower.
    Jon Sagara

    "Me fail English? That's unpossible!"
  14. #8
  15. /(bb|[^b]{2})/

    Join Date
    Nov 2001
    Location
    Somewhere in the great unknown
    Posts
    5,163
    Rep Power
    793
    You should learn C first. It will build a strong foundation for the C++ along with other languages that you may learn later on.

    1)If you are going to be doing only windows os operating system then learning C++ and MFC is the way to go. Especially if you are going to be using such things as database grids which is most definately best done with objects. The downside to MFC is that it can be overly complex at times and you can only use it on windoze.

    2)This is just a prefence to me. I really haven't found many cases where C++ was needed over C when doing CGI applications. If you don't need C++ it is sometimes easier to use C. It compiles faster and uses less code (for most cases).

    jonsagara:
    How is using the windows api overkill? It is definately good practice to know how to use them. Even if there are covered by MFC in C++, for years all that you could do was use the API and it is a good thing to know how to use them, even if it is something just as simple as using sleep. This helps more now when doing VB.
  16. #9
  17. No Profile Picture
    Not there when you need me
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Oct 2001
    Location
    Berlin, Germany
    Posts
    1,430
    Rep Power
    15
    Onslaught: using the API for drawing complete windows and making apps is overkill. Of course, using an API function here and there to do stuff is not. After all, what are the reference books and the MSDN for? If you need to do something below MFC level, you just look it up when needed.
  18. #10
  19. /(bb|[^b]{2})/

    Join Date
    Nov 2001
    Location
    Somewhere in the great unknown
    Posts
    5,163
    Rep Power
    793
    Ok, I guess I missread his post. I wasn't talking about using the api just for writting a window in C++, that is pointless when there are better tools for the job. It just sounded to me that he was saying there was no need to know the api, when they still have plenty of purpose even with the tools that MFC provides.
  20. #11
  21. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2001
    Location
    USA
    Posts
    286
    Rep Power
    13
    Onslaught:
    I should have been more clear. Like realnowhereman said, I feel it is a tremendous waste to try to build Windows applications from scratch when libraries like MFC and WTL are available. I also agree that understanding the underlying API really helps you to understand MFC. Like any aspect of programming, each tool has its use. It's up to you and me to figure out the appropriate time to use each tool. :)
    Jon Sagara

    "Me fail English? That's unpossible!"
  22. #12
  23. /(bb|[^b]{2})/

    Join Date
    Nov 2001
    Location
    Somewhere in the great unknown
    Posts
    5,163
    Rep Power
    793
    Now that statement I totaly agree with.

    Now I have a question? Has anyone tried using wxWindows? I have started playing around with it a little for making cross-os applications. Wish it was a little more stable.
  24. #13
  25. No Profile Picture
    Not there when you need me
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Oct 2001
    Location
    Berlin, Germany
    Posts
    1,430
    Rep Power
    15
  26. #14
  27. /(bb|[^b]{2})/

    Join Date
    Nov 2001
    Location
    Somewhere in the great unknown
    Posts
    5,163
    Rep Power
    793
    Thanks, I will have to check that out.
  28. #15
  29. No Profile Picture
    Python Prophet
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2001
    Location
    Amersfoort, The Netherlands
    Posts
    45
    Rep Power
    14
    Originally posted by Onslaught
    Now that statement I totaly agree with.

    Now I have a question? Has anyone tried using wxWindows? I have started playing around with it a little for making cross-os applications. Wish it was a little more stable.
    Yep, I do. I'm using it for a mail/news client in Python with the Python bindings for wxWindows. Although I don't know about the framework that is provided for developing cross-os apps, as this is already provided by Python, I think the GUI library is one of the best on for cross-os development. I don't know if you've ever used QT, but they're quite alike, except for the fact that wxWindows is really free(LGPL).

    Originally posted by realnowheremon
    I haven't tried it, just would like to say that it looks imho ugly. Try GTK - it's quite easy (at least for those who can C (I can't)) and you can do cross-platform stuff with it.
    Ugly? wxWindows uses native libraries for every platform, GTK+ or Motif for Unix, and the standard API's for Win32 and MacOS. So probably you think one of these is ugly, probably Motif, but instead of Motif you can also use GTK+, which you recommended yourself.
    Some people, when confronted with a problem, think I know, I'll use regular expressions. Now they have two problems. - Jamie Zawinski, in comp.lang.emacs
Page 1 of 2 12 Last
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo