[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: parentheses convention for C++ ?

From: John W. Eaton
Subject: Re: parentheses convention for C++ ?
Date: Wed, 15 Jul 2020 05:37:24 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0

On 7/14/20 10:57 AM, Rik wrote:

Just checking the last cset I see:

~/wip/Projects_Mine/octave-dev: hlog -p -r -1
changeset:   28577:5c6b4cbd417f
bookmark:    @
tag:         tip
user:        John W. Eaton <jwe@octave.org>
date:        Tue Jul 14 01:19:30 2020 -0400
summary:     avoid deprecated Qt QString::sprintf function

diff -r 1afdc349b883 -r 5c6b4cbd417f libgui/qterminal/libqterminal/unix/TerminalView.cpp --- a/libgui/qterminal/libqterminal/unix/TerminalView.cpp       Tue Jul 14 01:09:31 2020 -0400 +++ b/libgui/qterminal/libqterminal/unix/TerminalView.cpp       Tue Jul 14 01:19:30 2020 -0400
@@ -927,8 +927,7 @@ void TerminalView::showResizeNotificatio
           connect(_resizeTimer, SIGNAL(timeout()), _resizeWidget, SLOT(hide()));

-      QString sizeStr;
-      sizeStr.sprintf("Size: %d x %d", _columns, _lines);
+      QString sizeStr = QString("Size: %1 x %2").arg(_columns).arg(_lines);

In Octave m-files, the convention is a space between the function name and the parenthesis which starts the input parameter list.  Are we trying to follow that in C++ as well?  For example, in the above code, "_resizeWidget->setText(sizeStr)" there is no space between the member function name setText and the parenthesis.  If this is the convention, does it also apply to class constructors?  Should the code read "QString(...)" or "QString (...)"?

Yes, I think that's normally what I would try do but this file is in the qterminal directory and I was attempting to follow the conventions used there. It's code imported from another project that we're only making minimal changes to when necessary. But then I also realized that's probably impossible because the style seems to be all over the place in those files.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]