[Development] Could support for C be added to Qt?

Thiago Macieira thiago.macieira at intel.com
Sat Sep 10 19:41:22 CEST 2022


On Saturday, 10 September 2022 10:02:05 PDT samuel ammonius wrote:
> These may not seem like huge issues, but the fact
> that the
> language has no problem with anything that the actual computer doesn't have
> a
> problem with is something very valuable for most C developers, so they
> probably
> won't want to switch.

I'd say "touch luck".

First, your own example of not having compile-time checking of the means that 
those programmers are accepting less security for the sake of staying in the 
same language.

Second and most importantly, they don't need to switch the entire code base. 
They need only to add some C++ source files to their software so they can use 
Qt from there. Their existing logic can remain in C as much as they'd like. It 
stands to reason no one is using Qt from C today because there is no binding, 
so we're not asking for porting. All such potential codebases would need new 
code added anyway, so why not add the new code in C++?

> parameter's type. Here
> <https://github.com/sammonius/qtc/blob/main/header/qpushbutton.h>'s one
> example (QPushButton_new(), lines 12-21).

Indeed. Excerpt:

static inline QPushButton QPushButton_new_parent(QWidget parent);
static inline QPushButton QPushButton_new_text(QString text);

The issue here is *automation*. A human can look at the parameters and decide 
that this function should be called "parent" and this other one "text", but 
how does a tool do that in an automated fashion?

Don't say the parameter names. It's very easy to have an overload that differs 
in type but the names and quantity are the same.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Cloud Software Architect - Intel DCAI Cloud Engineering





More information about the Development mailing list