I realize C is a bit of a subset of C++. I also realize classes make polymorphism, inheritance, and a host of other things possible, including more disciplined variable use, etc.
Is it relatively easy to stick with C programming logic while developing with Gtk 4.0?
I had a lovely experience with Gtk 3.0, however I used my favorite programming language.
Thanks,
Roark
p.s. I realize I will have to port my app so that it uses Gtk 4.0 commands, however I would rather not have to convert all the code from C to C++.
Background: I personally, never warmed up to C++, despite having it forced on me in school. Many of us who tried to follow the rules and do everything in C++ (as the instructor said was required) got much lower grades than those who just used C programming in the final project.
I recently saw an ‘ad’ for Gtk 4.0 which boasted multiple language support including: C++, Python, Javascript, etc. Yet, C was not mentioned.
In the example(s), I saw only C++ code with all the usual (dreaded on my part) references to ‘protected’ vs ‘public’ vs ‘private’, references to instantiation procedures, etc.
All for a simple ‘hello world’ example.
Thanks for your input!
I fear (despite all my efforts to build a nice Gtk 3.0 app using the C programming language, I will have little choice but to switch to something like Tkinter.
In general, GTK is an object oriented library—even in C. You do have to understand inheritance and the object lifetime, from instantiation to finalization, otherwise you are going to have a bad time.
I do see the example you mentioned, however I was referring to the Language Bindings page (gtk dot org/docs/language-bindings). On this page, there is a list and C++ is what is listed, but not C.
What I did not notice until now, is that C++ (not C) is listed for Gtk 3.0 (as well as 4.0).
It would seem to me that (despite my reluctance) I can start converting my app to make use of C++ constructs, while still using Gtk 3.0, prior to porting it over to Gtk 4.0.
Maybe it was an incorrect assumption on my part, but I was basing it on what I saw on the Language Bindings page (gtk dot org/docs/language-bindings), namely no mention of C, only C++.
I now see that C++ was supported earlier, so maybe I can get my C programming converted over to C++ constructs using Gtk 3.0 first.
A binding is like a translation, you generally don’t translate something into the language it’s already in - not sure what that would even mean for Gtk + C
I guess we could generate headers from GIR but it would be rather pointless and just asking for ABI errors (how would renames work? and now you’ve lost all you C utilities APIs that are (skip)ed)
Sure, but if you don’t want to use C++ (and I don’t blame you): Don’t use C++