TU Darmstadt / ULB / TUbiblio

Checking C++ Codes for Compatibility with Operator Overloading

Hück, Alexander ; Bischof, Christian ; Utke, Jean (2015)
Checking C++ Codes for Compatibility with Operator Overloading.
In: 2015 IEEE 15th International Working Conference on Source Code Analysis and Manipulation (SCAM), 15
doi: 10.1109/SCAM.2015.7335405
Artikel, Bibliographie

Kurzbeschreibung (Abstract)

Operator overloading allows the semantic extension of existing code without the need for sweeping code changes. For example, automatic differentiation tools in C++ commonly use this feature to enhance the code with additional derivative computation. To this end, a floating point data type is changed to a complex user-defined type. While conceptually straightforward, this type change often leads to compilation errors that can be tedious to decipher and resolve. This is due to the fact that the built-in floating point types in C++ are treated differently than user-defined types, and code constructs that are legal for floating point types can be a violation of the C++ standard for complex user-defined types. We identify and classify such problematic code constructs and suggest how the code can be changed to avoid these errors, while still allowing the use of operator overloading. To automatically flag such occurrences, we developed a Clang-based tool for the static analysis of C++ code based on our assessment of constructs problematic in operator overloading for numeric types. It automatically finds instances of problematic code locations and prints Lint-like warning messages. To showcase the relevance of this topic and the usefulness of our tool, we consider the basic routines of the OpenFOAM CFD software package, consisting of 1,476 C++ source and header files, for a total of over 150,000 lines of code. Altogether, we found 74 distinct occurrences of problematic code constructs in 21 files. As some of these files are included in over 400 different locations in the OpenFOAM base, errors in these files create a torrent of error messages that often are difficult to comprehend. In summary, the classification of problematic instances aids developers in writing numerical code that is fit for operator overloading and the tool helps programmers that augment legacy code in spotting problematic code constructs.

Typ des Eintrags: Artikel
Erschienen: 2015
Autor(en): Hück, Alexander ; Bischof, Christian ; Utke, Jean
Art des Eintrags: Bibliographie
Titel: Checking C++ Codes for Compatibility with Operator Overloading
Sprache: Englisch
Publikationsjahr: 28 September 2015
Verlag: IEEE
Titel der Zeitschrift, Zeitung oder Schriftenreihe: 2015 IEEE 15th International Working Conference on Source Code Analysis and Manipulation (SCAM)
Jahrgang/Volume einer Zeitschrift: 15
Buchtitel: 2015 IEEE 15th International Working Conference on Source Code Analysis and Manipulation (SCAM)
Reihe: IEEE International Workshop on Source Code Analysis and Manipulation
Veranstaltungstitel: 2015 IEEE 15th International Working Conference on Source Code Analysis and Manipulation (SCAM)
Veranstaltungsort: Bremen, Germany
Veranstaltungsdatum: 27-28 Sept 2015
DOI: 10.1109/SCAM.2015.7335405
URL / URN: http://ieeexplore.ieee.org/servlet/opac?punumber=7321933
Zugehörige Links:
Kurzbeschreibung (Abstract):

Operator overloading allows the semantic extension of existing code without the need for sweeping code changes. For example, automatic differentiation tools in C++ commonly use this feature to enhance the code with additional derivative computation. To this end, a floating point data type is changed to a complex user-defined type. While conceptually straightforward, this type change often leads to compilation errors that can be tedious to decipher and resolve. This is due to the fact that the built-in floating point types in C++ are treated differently than user-defined types, and code constructs that are legal for floating point types can be a violation of the C++ standard for complex user-defined types. We identify and classify such problematic code constructs and suggest how the code can be changed to avoid these errors, while still allowing the use of operator overloading. To automatically flag such occurrences, we developed a Clang-based tool for the static analysis of C++ code based on our assessment of constructs problematic in operator overloading for numeric types. It automatically finds instances of problematic code locations and prints Lint-like warning messages. To showcase the relevance of this topic and the usefulness of our tool, we consider the basic routines of the OpenFOAM CFD software package, consisting of 1,476 C++ source and header files, for a total of over 150,000 lines of code. Altogether, we found 74 distinct occurrences of problematic code constructs in 21 files. As some of these files are included in over 400 different locations in the OpenFOAM base, errors in these files create a torrent of error messages that often are difficult to comprehend. In summary, the classification of problematic instances aids developers in writing numerical code that is fit for operator overloading and the tool helps programmers that augment legacy code in spotting problematic code constructs.

Fachbereich(e)/-gebiet(e): 20 Fachbereich Informatik
20 Fachbereich Informatik > Scientific Computing
Zentrale Einrichtungen
Zentrale Einrichtungen > Hochschulrechenzentrum (HRZ)
Zentrale Einrichtungen > Hochschulrechenzentrum (HRZ) > Hochleistungsrechner
Hinterlegungsdatum: 30 Sep 2015 08:51
Letzte Änderung: 07 Jan 2021 10:05
PPN:
Zugehörige Links:
Export:
Suche nach Titel in: TUfind oder in Google
Frage zum Eintrag Frage zum Eintrag

Optionen (nur für Redakteure)
Redaktionelle Details anzeigen Redaktionelle Details anzeigen