Thread: What is there out there to be explored?

  1. #1
    Learning C. JOZZY& Wakko's Avatar
    Join Date
    Nov 2009
    Posts
    59

    What is there out there to be explored?

    I was wondering what is out there concerning C to look at in the future.

    I know there is socket programming (what I presume is networking) and AI programming but what more is there and when is it used for example? Looking at AI programming I would presume it is used mostly in games...

    Next to that is it possible to code a GUI in C or do I need to learn C++ or a different language next to C if I would like to code one?

    Thanks in advance.

  2. #2
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    Quote Originally Posted by JOZZY& Wakko View Post
    I was wondering what is out there concerning C to look at in the future.

    I know there is socket programming (what I presume is networking) and AI programming but what more is there and when is it used for example? Looking at AI programming I would presume it is used mostly in games...

    Next to that is it possible to code a GUI in C or do I need to learn C++ or a different language next to C if I would like to code one?

    Thanks in advance.
    The list of applications is endless, from flight control to robots.

    For GUIs in C, I use Gtk+ (GTK+ - About) which is fantastic (mostly ).

  3. #3
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195
    Quote Originally Posted by JOZZY& Wakko View Post
    I was wondering what is out there concerning C to look at in the future.

    I know there is socket programming (what I presume is networking) and AI programming but what more is there and when is it used for example? Looking at AI programming I would presume it is used mostly in games...
    Sometimes AI is used for serious projects.

    Although you will find that most AI is done with C++. And most games don't use real AI, they use scripting, with the exception of a few like the original Quake that used neural networks I believe.
    Next to that is it possible to code a GUI in C or do I need to learn C++ or a different language next to C if I would like to code one?

    Thanks in advance.
    You can code a GUI entirely in C if you want.
    Last edited by abachler; 12-02-2009 at 09:32 AM.

  4. #4
    The larch
    Join Date
    May 2006
    Posts
    3,573
    Code:
    You can code a GUI entirely in C if you want.
    However, that might not be what you want?...
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

  5. #5
    Learning C. JOZZY& Wakko's Avatar
    Join Date
    Nov 2009
    Posts
    59
    Quote Originally Posted by abachler View Post
    You can code a GUI entirely in C if you want.
    Looking at the latest reply I suddenly doubt that it is the smartest idea to code it in C.

    Is GTK+ the "easiest", "most used" way or are there other options out there that are more used?

  6. #6
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by JOZZY& Wakko View Post
    Looking at the latest reply I suddenly doubt that it is the smartest idea to code it in C.
    100% of GNU/linux is in C (not C++), including the GUI. If you use KDE, KDE is Qt, which is C++. But Gnome and most of the other desktops are Gtk+, which is a C API. At least 75% of independent linux GUI applications are gtk+/C.

    But if YOU prefer to code in C++, then doing anything in C is probably not the smartest choice for YOU.

    Is GTK+ the "easiest", "most used" way or are there other options out there that are more used?
    On linux, gtk is far and away the most widely used. On other platforms, I think gtk would be considered an oddity, but it is portable to all of them. A very nice thing about gtk (from a linux perspective) is that it is built on glib, which has a ton of useful stuff in it besides just a GUI. 99.9% of linux installations rely heavily on glib regardless of the GUI.

    wxwidgets is C++ and I think not used that much on any platform, but it is used on all the major ones, and apparently "uses the platform's native API" (which on linux would be gtk, it looks like). I've never tried it and this implies an added layer of abstraction, which may be an expense performance wise.

    Windows has it's own non-portable GUI API.

    Qt is C++ is (I believe) the native GUI for Apple Mac. It also common on linux and portable to windows.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  7. #7
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Quote Originally Posted by JOZZY& Wakko View Post
    Looking at the latest reply I suddenly doubt that it is the smartest idea to code it in C.
    I don't know what you mean by "coding a GUI in C". An application? Or a true Graphical User Interface to run applications on top of it?

    If the latter, then maybe C is a good idea. At least for the core engine. C++ could then be used one layer above to link your engine with an Object Model Interface. If the former then C++ seems a smarter move since you can directly benefit from the existing object model driven engines like GTK for Linux or WinAPI/MFC for Windows.

    Is GTK+ the "easiest", "most used" way or are there other options out there that are more used?
    What operating system will you be developing in/for?
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  8. #8
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,229
    I believe Mac uses a non-portable API just like Windows. Called Carbon or Cocoa or something.

    Qt is only native to KDE. It "looks and feels" natively on all platforms, though, but I'm not sure if it calls the native API or if it emulates.

  9. #9
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    The question isn't what is out there to be explored but what isn't out there to be explored. There are millions of real-world applications where C can be used. Whether it is or not is not b/c it cannot be but because someone chose not to use it.

  10. #10
    Learning C. JOZZY& Wakko's Avatar
    Join Date
    Nov 2009
    Posts
    59
    What I am trying to figure out is what I would need to learn to be able to code a GUI for a simple program. For example what is used to code a GUI for what you see on top of your desktop right now?

    I am pretty new to this and some of the used terms are confusing me a bit. I am sure when I read this again in a few months I understand more of it but is there any difference in coding the interface on a Linux and Windows machine and is the difference of any importance and if yes in what way?

    What would I need to code a program for someone in Windows that looks "better" with an nice interface then something then just runs in the command prompt window?

    Sorry if the explanation sounds noobish or is noobish I am just trying to learn here.

  11. #11
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    A good place to start would be C++ and the wxWidgets library. I cannot think of a simpler, yet robust, combination for Windows development.

    The book advertised on the homepage is necessary in my opinion however. It will introduce you to the library in a more organized way and you'll gain a better understanding of what and how you can do. You won't have to be fishing for web tutorials to build up your knowledge on wxWidgets (a task that will almost certainly force you to eventually quit learning about it).

    This does mean you need to learn C++. I just don't see any advantage on using C for GUI-based programming on Windows. Neither I know of C-based solution that can beat wxWidgets.
    Last edited by Mario F.; 12-03-2009 at 07:37 AM.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  12. #12
    Learning C. JOZZY& Wakko's Avatar
    Join Date
    Nov 2009
    Posts
    59
    Quote Originally Posted by Mario F. View Post
    A good place to start would be C++ and the wxWidgets library. I cannot think of a simpler, yet robust, combination for Windows development.

    The book advertised on the homepage is necessary in my opinion however. It will introduce you to the library in a more organized way and you'll gain a better understanding of what and how you can do. You won't have to be fishing for web tutorials to build up your knowledge on wxWidgets (a task that will almost certainly force you to eventually quit learning about it).

    This does mean you need to learn C++. I just don't see any advantage on using C for GUI-based programming on Windows. Neither I know of C-based solution that can beat wxWidgets.
    The GTK+ website mentioned that applications could easily be converted from the Windows to the Unix platform using GTK+?

    Next to that my basic need now is to learn it for the Windows platform. But imagine I would want to code for the Unix platform in a later stage would wxWidgets then still be the best choice as I understand most of the Unix system is coded in C?

    What would the exact differences be if I choose to keep coding in C including GUI's later in instead of stepping over to C++?

  13. #13
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by JOZZY& Wakko View Post
    The GTK+ website mentioned that applications could easily be converted from the Windows to the Unix platform using GTK+?
    If you are on windows, I would install gtk first and try a gtk windows app to see how it looks and feels first. I have heard gtk on win is sort of gimpy.

    Next to that my basic need now is to learn it for the Windows platform. But imagine I would want to code for the Unix platform in a later stage would wxWidgets then still be the best choice as I understand most of the Unix system is coded in C?
    That's not to saying nothing is done in C++, for sure a lot of things are, eg, firefox. There are wxwidget apps on linux, just very few of them, I can't really vouch for it, but in theory it exists.

    What would the exact differences be if I choose to keep coding in C including GUI's later in instead of stepping over to C++?
    If you are already programming in C++, this is your decision to make. If not, you certainly don't need to learn it for this.

    If I were you, I would just use the plain WinAPI for now (which I think is just C, and is probably easier than anything else if there is enough documentation, etc, around). If you want to do stuff for *nix later, you can learn gtk. Realistically, you probably won't want or need to port your first few projects to another platform. GUI programming (like everything else) has a surprising number of potential twists, so you have to accept that as you learn, your methodology will change in unpredictable ways. Meaning you scrap the old methods. Once that evolution starts to "plateau" you will be more ready to think about cross-platform stuff.

    Also, I've done a few fairly complex apps using several different GUI toolkit libraries, in several different languages. IMO, there are certain fundamental elements that are (almost certainly) common to all of them regardless of the language or the library. No matter what you choose, you will be learning those fundamentals in the process, and you can apply that knowledge to any of the other GUI API's later. So it is not as if you must commit yourself permanently to, eg, wxwidgets, or the WinAPI, and will be starting from scratch if you change your mind later.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  14. #14
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Quote Originally Posted by JOZZY& Wakko View Post
    The GTK+ website mentioned that applications could easily be converted from the Windows to the Unix platform using GTK+?
    While GTK+ offers windows ports, this library is not primarily targeted at Windows. I can't recall the specifics. It's been over 2 years since I last hunt down for a GUI framework. But remember specifically having lots of trouble with the Grid control under windows, for instance. Or understanding that any new developments on the main X port will take ages to be ported to windows.

    Also GTK+, contrary to wxWidgets doesn't use the Windows native controls. It uses the Wimp Theme, which while pretty successful at imitating most of the Windows XP look and fell is NOT native neither it passes for Windows XP. It will not allow you to build applications with Windows Vista/7 look and feel, either.

    GTK+ however has the advantage of allowing you to program in C. But I can't think of one reason why you should.

    Next to that my basic need now is to learn it for the Windows platform. But imagine I would want to code for the Unix platform in a later stage would wxWidgets then still be the best choice as I understand most of the Unix system is coded in C?
    wxWidgets is cross-platform too. Haven't you click the link I gave you?
    It runs on more platforms than GTK+ in fact. It's older also. It's one of the first cross-platform GUI libraries (I think it's actually the oldest in existence and definitely the most mature). And you even have editors for Rapid Application Development under wxWidgets (DialogBlocks being one of the best).

    What would the exact differences be if I choose to keep coding in C including GUI's later in instead of stepping over to C++?
    - By sticking to C you will be limiting your options in terms of GUI frameworks you can use. As you see, the mere thought alone has eliminated already wxWidgets, QT, or WinAPI/MFC/ATL as possibilities. Leaving you pretty much with only one serious framework, GTK+.

    - GUI programming is naturally Object Oriented. The GUI structure is more easily understood, described and used in a object oriented programming language. While this doesn't mean at all C isn't usable, unless you have a very specific reason to use it (which apparently you don't. You just seem not to be wanting to learn it), C will slow down your development of GUI applications. In contrast C++ will offer you all the tools for Object Oriented Programming. And beyond...
    Last edited by Mario F.; 12-03-2009 at 10:51 AM.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  15. #15
    Learning C. JOZZY& Wakko's Avatar
    Join Date
    Nov 2009
    Posts
    59
    So if I get it right on this one using C++ would allow me to design and code a GUI faster then I would be able to do it in GTK+?

    Next to that what is mostly used by company's these these to code software for their clients that need a GUI, C, C++ or something different?

    I am currently learning C. But I suppose that catching up with C++ later on after the book MK27 referred me to would be easy enough with a basic understanding of the C language?

Popular pages Recent additions subscribe to a feed