PowerTuneDigital / PowerTuneDigitalOfficial

Official PowerTune Digital Repo
GNU General Public License v3.0
18 stars 7 forks source link

Replaces all instances of `endl` with `Qt::endl` #124

Closed pgrandin closed 5 months ago

pgrandin commented 5 months ago

This commit replaces all instances of endl with Qt::endl across the codebase. The update is in line with the deprecation warnings introduced in Qt 5.14 and ensures compatibility with future versions of Qt.

Right now, compiling Powertune on more modern version of QT (like the LTS 5.15) generates over 50 warnings.

Reasons for switching to Qt::endl:

  1. Consistency: Qt::endl aligns with Qt naming conventions and integrates better with the Qt framework.
  2. Performance: Unlike endl, which always flushes the output stream, Qt::endl provides better control over when the stream is flushed. This can improve performance, especially in scenarios where frequent flushing is unnecessary and can be managed explicitly.
  3. Future-Proofing: Adhering to the latest standards in Qt ensures easier maintenance and fewer modifications during future upgrades.

The Qt documentation for QTextStream explains that endl is a manipulator that inserts a newline character into the stream and flushes the stream. This automatic flushing can lead to performance overhead when used in loops or high-frequency logging. Switching to Qt::endl allows developers to control flushing more explicitly, which can optimize performance by reducing unnecessary flushes.

github-actions[bot] commented 5 months ago

Here are the first 10 encountered errors:

Apexi.cpp(3): error cpplint: [build/include_subdir] Include the directory when naming header files [4]
Apexi.cpp(4): error cpplint: [build/include_order] Found C system header after other header. Should be: Apexi.h, c system, c++ system, other. [4]
Apexi.cpp(5): error cpplint: [build/include_order] Found C system header after other header. Should be: Apexi.h, c system, c++ system, other. [4]
Apexi.cpp(6): error cpplint: [build/include_order] Found C system header after other header. Should be: Apexi.h, c system, c++ system, other. [4]
Apexi.cpp(7): error cpplint: [build/include_order] Found C system header after other header. Should be: Apexi.h, c system, c++ system, other. [4]
Apexi.cpp(8): error cpplint: [build/include_order] Found C system header after other header. Should be: Apexi.h, c system, c++ system, other. [4]
Apexi.cpp(9): error cpplint: [build/include_order] Found C system header after other header. Should be: Apexi.h, c system, c++ system, other. [4]
Apexi.cpp(10): error cpplint: [build/include_order] Found C system header after other header. Should be: Apexi.h, c system, c++ system, other. [4]
Apexi.cpp(22): error cpplint: [whitespace/comments] Should have a space between // and comment [4]

Done processing Apexi.cpp Done processing connect.cpp Done processing datalogger.cpp Done processing wifiscanner.cpp Category 'build' errors found: 49 Category 'readability' errors found: 6 Category 'whitespace' errors found: 656 Total errors found: 711