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

samuel ammonius sfammonius at gmail.com
Sun Sep 11 03:53:24 CEST 2022


> This is something where C and C++ developers learn very different
> philosophies that they have each put a lot of effort into. In C++,
> casting between pointer types is considered quite dangerous if the
> compiler doesn't check for human error. This is a basic concept
> learned early on and adhered to in standard C++ codebases.

What kind of human error would make converting between the
pointers dangerous? I've never understood the point of C++
making pointer types incompatible and then introducing templates
to bypass this by making a new function for each pointer.

> They may be resistant to adding C++
> code, with its slow compile speed and incompatibilities with archaic
> platforms they may still support, just as a C++  project may be
> resistant to turning all their templates into macros.

That's true, but as much as templates make me want to throw up,
I wasn't going to change them into macros. I was just going to use
macros as a way to declare template functions for C, while still
leaving the templates untouched for C++.

(I don't see why not use a macro with static casts instead of a
template though. It would probably double the compile speed, and
there's no practical way that a human error would happen.)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20220910/52f65dee/attachment.htm>


More information about the Development mailing list