[Qt-creator] Quick test or scratch-pad mode in qtc?

Jesus Fernandez jesus.fernandez at qt.io
Wed Jan 2 10:36:21 CET 2019


Hi,


You can create a custom instance of godbolt with Qt support:

https://blog.qt.io/blog/2017/06/22/using-compiler-explorer-qt/

[https://qt-blog-uploads.s3.amazonaws.com/wp-content/uploads/2017/06/Screenshot_20170622_152005.png]<https://blog.qt.io/blog/2017/06/22/using-compiler-explorer-qt/>

Using Compiler Explorer with Qt - Qt Blog<https://blog.qt.io/blog/2017/06/22/using-compiler-explorer-qt/>
blog.qt.io
One of my preferred developer tools is a web called Compiler Explorer. The tool itself is excellent and useful when trying to optimize your code. The author of the tool describes it in the Github repository as: Compiler Explorer is an interactive compiler. The left-hand pane shows editable C/C++






Best regards,

Jesús

________________________________
From: Qt-creator <qt-creator-bounces at qt-project.org> on behalf of Jeandet Alexis <alexis.jeandet at lpp.polytechnique.fr>
Sent: Saturday, December 22, 2018 8:02:13 PM
To: qt-creator
Subject: Re: [Qt-creator] Quick test or scratch-pad mode in qtc?

Le samedi 22 décembre 2018 à 17:13 +0100, André Hartmann a écrit :
Hi Alexis,

 > I was wondering if this would be totally stupid to have a mode in QTC
 > were we could code in a single source with no Build System setup?
[...]
 > is so convenient to just start writing code without any setup.

Sounds good.

 > But this has many drawbacks like, no or almost no completion, no debug
 > and needs internet.

So may I ask what your goal is? Is it:

* Proof that your code compiles?
It depends what you mean here, it can be to check "can I write this?" like "is auto here allowed?"
Sometime also it is also good to be able to check if feature X works on compiler Y.
* Run a small (console) application?
nope
* Look at the generated assembly output?
sometime to check what is evaluated at build time

-> usually this is more to focus on a smaller and simpler code to solve some problems.
For example I was working on this library:
https://github.com/jeandet/TimeSeries/blob/master/include/TimeSeries.h
I had to test few things alone (to avoid brain overheat ;)) like
- how to use CRTP to compose classes with abstract behaviours
- how to make a custom iterator which yield a fake value

To be more general, when I face an issue and feel that my code is too big to reason about something, I just extract the few classes I want to focus on and work on Coliru.
Or also before I start something I do some tests on coliru if I'm not sure the concept works.

In principle, one could think of a "scratch" wizard, that

* Creates a project with a unique name like
   "QTC-Scatch-2018-12-22-17-08"
* Uses qmake as build system
* Uses the default "desktop" kit with it's Qt version
   and compiler
* Adds a main.cpp and opens it in the editor

You could than choose other compilers through the usual Projects mode,
build, run and debug your project. Other compiler options could be set
in the Project .pro file.

That would reduce the setup to two or three clicks and looks simple
enough to be integrated without big effort.

What do you think?
Yes that would definitely speed up things and guess this wouldn't ask too much work.
In the future that would be awesome to get closer to Coliru and Godblot; get rid of qmake and just set the cpp compiler in a drop down menu.
The issue with QTC is that you can only switch between kits. Being able to just switch the compiler from the editor would be nice allow to both check compiler capability and sometime get better error messages.

Best regards,
André


Am 22.12.18 um 12:12 schrieb Jeandet Alexis:
Hello,

I was wondering if this would be totally stupid to have a mode in QTC
were we could code in a single source with no Build System setup?
I always go to websites like coliru, godbolt, wandbox,... to do some
tests(test concepts, see if I can template something,...) because this
is so convenient to just start writing code without any setup. But this
has many drawbacks like, no or almost no completion, no debug and needs
internet.

In QTC I would easily see a section in welcome page "scratch-pad" with
previous ones and a button to create a new one. I don't think we should
care about file location or any setup, source files could be stored in
QTC user data folder. Maybe we could just switch among available
compilers and set manually compile args like godbolt.

Am I the only one who miss this feature?
If no I will definitely open a BR.

Best regards and happy holidays,
Alexis.


_______________________________________________
Qt-creator mailing list
Qt-creator at qt-project.org<mailto:Qt-creator at qt-project.org>
https://lists.qt-project.org/listinfo/qt-creator

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qt-creator/attachments/20190102/3ffd204e/attachment.html>


More information about the Qt-creator mailing list