Einzelhochschule Allocator. C89 kompatibel.
arena.h Arena -Allokatoren sind eine einfache Möglichkeit, eine einfachere, schnellere und sicherere dynamische Speicherverwaltung zu erreichen, indem mehrere Zuordnungen als Gruppe befreit werden können. Dies geschieht durch die Zuweisung von Speicher in großen Regionen und die Verteilung von Teilen dieses Speichers nach Bedarf, wodurch die Menge an malloc -Anrufen (die langsam im Vergleich zu einfacher Zeigerarithmetik) reduziert wird.
Wenn Sie die Arena zerstören, befreien Sie sie auch und den gesamten Inhalt und verringern die Anzahl der free Anrufe, die ebenfalls langsam sind. Weiterhin können Sie Arenen löschen, indem Sie einfach ihre Speicherzeiger auf 0 zurücksetzen, sodass Sie sie wiederverwenden und die Notwendigkeit noch mehr malloc und free beseitigen können.
Sie können mehr über Allokatoren Arena/Zone/Region erfahren, indem Sie diesen fantastischen Artikel lesen.
Ich werde das kurz halten. Ich behalte C89 Compliance zum Spaß, nicht weil ich es benutze. Ich persönlich bin ein C11 -Genießen. Wenn Sie der Meinung sind, dass C89 der einzige Weg ist, gut für Sie! Aber du liegst falsch.
Immer wenn ich dieses Projekt mit anderen Programmierern teile, ist eine der häufigsten Antworten, die ich erhalte, in der Reihe: Sie sollten niemals Implementierungs-/Logikcode in eine Header -Datei einfügen! Ich habe mit dieser Aussage aus drei Gründen in Frage gestellt ...
Es zeigt, dass im Bildungssystem ein veraltetes und infolgedessen schädlicher Konstrukt immer noch durchgesetzt wird, in dem das Konstrukt normalerweise eingeführt wird.
Sehr selten hat die Person, die diese Aussage macht, einen tatsächlichen Grund, sie zu glauben. Denken diese Person jemals darüber nach, warum sie "niemals Implementierungs-/Logikcode in eine Header -Datei einfügen" sollte? Einfach wieder aufzunehmen, was sie ohne Grundlage dafür gehört haben, warum sie sich dafür entschieden haben, ihm zuzustimmen, hilft mir in keiner Weise, und diese Person sollte nicht erwarten, dass ich es einfach so akzeptiere, wie sie es getan haben.
Die größte und gültigste Kritik an Bibliotheken Nur-Header-/Einzelhochern ist, dass eine Änderung des Headers eine erneute Kompilierung aller Dateien erfordert, die sie enthalten. Im Fall meines Projekts führt die Änderungen an arena.h , obwohl die tatsächliche Implementierung nur in der Übersetzungseinheit enthalten ist, die das Makro der ARENA_IMPLEMENTATION -Makro von #define , zum Wiederaufbau aller Dateien, die es enthalten. Die Lösung? Sobald arena.h im gewünschten Zustand ist, nehmen Sie auf, Änderungen vorzunehmen!
Die Verknüpfung ist träge und kompliziert. Viele Anfänger haben oft Probleme damit, den Verknüpfungsprozess zu lernen, und sie sind auch der größte Schuldige, wenn es darum geht, unsicheren Code zu schreiben. Dies allein ist genug Grund für mich, diesen Allocator für Arena zu einer Bibliothek nur zur Header zu machen. Mein Code (in seinem aktuellen Zustand) ist sehr klein, ungefähr 300 Zeilen. Warum sollte ich Sie dazu bringen, eine so kleine Implementierung zu erstellen und zu verknüpfen, wenn Sie sie einfach einmal #include und anfangen konnten, sie außerhalb der Box zu verwenden? Wenn Sie wirklich ein Problem damit haben, hindert dieser Allocator im Einzelhaderformat nicht daran, dem Quell-+Header-Konstrukt zu folgen, wenn Sie dies wünschen. Heck, zögern Sie nicht, es zu geben und es aus einem Grund Open Source zu machen!
Dies implementiert nicht einen Allocator auf Kernelebene, sondern wickelt malloc und free (Standardbibliothek oder Custom, Ihre Wahl).
Ich glaube zwar, dass Software Open Source sein sollte, aber ich glaube nicht, dass es ethisch ist, Software zu verlangen, die diese Bibliothek auch für Open Source verwendet. In der Moderne der Technologie und im gegenwärtigen Zustand der Welt ist das Schreiben von Gedächtniscode wichtiger denn je. Aus diesem Grund ist diese Software unter der Apache -Lizenzversion 2.0 lizenziert. Sie werden nachdrücklich empfohlen, die LICENSE (unten in arena.h und eine eigene Datei in diesem Repo enthalten) zu lesen, wenn Sie in Betracht ziehen, die Software zu verwenden, es sei denn, Sie glauben, dass Sie mit den Bedingungen zu 100% vertraut sind.
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Copyright 2024 Carter Dugan
Die Dokumentation für den Arena Allocator kann alle in arena.h gefunden werden. Es gibt einen Kommentar oben in der Header -Datei mit schnellen Anweisungen zur Nutzung für Ihre Bequemlichkeit.
Für eine Datei in einer Übersetzungseinheit benötigen Sie Folgendes:
#define ARENA_IMPLEMENTATION
#include "arena.h" Ab diesem Zeitpunkt können andere Dateien in anderen Übersetzungseinheiten #include "arena.h" . Es gibt zusätzliche Makros, die Sie definieren/verwenden können. Siehe den Abschnitt über Funktionen und Makros.
Es gibt zwei Strukturen in arena.h . Dies listet jeden zusammen mit seinen Mitgliedern auf.
Arena_Allocation Die Datenstruktur für eine Arena -Zuordnung. Nur verfügbar, wenn ARENA_DEBUG definiert ist.
size_t index den Index in der Arena, in dem sich der Beginn der Zuweisung befindet.size_t size Die Größe des Speichers, das dieser Allokation in Bytes zugeordnet ist.char *pointer Der für die Zuordnung zugeordnete Zeiger.struct Arena_Allocation_s *next Die nächste Zuweisung in der verlinkten Liste. Arena Die Datenstruktur für eine Arena.
char *region Die Region des zugewiesenen Gedächtnisses.size_t index Der Index der Region für den nächsten Zeiger, der verteilt wird.size_t size Die in Bytes zugewiesene Speichergröße der Arena.unsigned long allocations Die Anzahl der vorgenommenen Arena -Zuweisungen. Nur verfügbar, wenn ARENA_DEBUG definiert ist.Arena_Allocation *head_allocation Die erste Zuordnung in der Arena (verwendet für eine verknüpfte Liste). Nur verfügbar, wenn ARENA_DEBUG definiert ist. /*
Allocate and return a pointer to memory to the arena
with a region with the specified size. Providing a
size of zero results in a failure.
Parameters:
size_t size | The size (in bytes) of the arena
memory region.
Return:
Pointer to arena on success, NULL on failure
*/
Arena * arena_create ( size_t size );
/*
Return a pointer to a portion of specified size of the
specified arena's region. Nothing will restrict you
from allocating more memory than you specified, so be
mindful of your memory (as you should anyways) or you
will get some hard-to-track bugs. By default, memory is
aligned by alignof(size_t), but you can change this by
#defining ARENA_DEFAULT_ALIGNMENT before #include'ing
arena.h. Providing a size of zero results in a failure.
Parameters:
Arena *arena | The arena of which the pointer
from the region will be
distributed
size_t size | The size (in bytes) of
allocated memory planned to be
used.
Return:
Pointer to arena region segment on success, NULL on
failure.
*/
ARENA_INLINE void * arena_alloc ( Arena * arena , size_t size );
/*
Same as arena_alloc, except you can specify a memory
alignment for allocations.
Return a pointer to a portion of specified size of the
specified arena's region. Nothing will restrict you
from allocating more memory than you specified, so be
mindful of your memory (as you should anyways) or you
will get some hard-to-track bugs. Providing a size of
zero results in a failure.
Parameters:
Arena *arena | The arena of which the pointer
from the region will be
distributed
size_t size | The size (in bytes) of
allocated memory planned to be
used.
unsigned int alignment | Alignment (in bytes) for each
memory allocation.
Return:
Pointer to arena region segment on success, NULL on
failure.
*/
void * arena_alloc_aligned ( Arena * arena , size_t size , unsigned int alignment );
/*
Copy the memory contents of one arena to another.
Parameters:
Arena *src | The arena being copied, the source.
Arena *dest | The arena being copied to. Must be created/allocated
already.
Return:
Number of bytes copied.
*/
ARENA_INLINE size_t arena_copy ( Arena * dest , Arena * src );
/*
Reset the pointer to the arena region to the beginning
of the allocation. Allows reuse of the memory without
realloc or frees.
Parameters:
Arena *arena | The arena to be cleared.
*/
ARENA_INLINE void arena_clear ( Arena * arena );
/*
Free the memory allocated for the entire arena region.
Parameters:
Arena *arena | The arena to be destroyed.
*/
ARENA_INLINE void arena_destroy ( Arena * arena );
/*
Returns a pointer to the allocation struct associated
with a pointer to a segment in the specified arena's
region.
Parameters:
Arena *arena | The arena whose region should
have a portion pointed to by
ptr.
void *ptr | The ptr being searched for
within the arena in order to
find an allocation struct
associated with it.
*/
Arena_Allocation * arena_get_allocation_struct ( Arena * arena , void * ptr );
/*
Adds an arena allocation to the arena's linked list of
allocations under debug.
Parameters:
Arena *arena | The arena whose allocation list
should be added to
size_t size | The size of the allocation being
added.
*/
void arena_add_allocation ( Arena * arena , size_t size );
/*
Deletes the arena's linked list of allocations under
debug.
Parameters:
Arena *arena | The arena whose allocation list
is being deleted.
*/
void arena_delete_allocation_list ( Arena * arena ); In Ihrem Code können Sie einige optionale Makros definieren. ARENA_MALLOC , ARENA_FREE und ARENA_MEMCPY können alternativen malloc -ähnlichen, free -like und memcpy -ähnlichen Funktionen zugeordnet werden, und arena.h wird sie anstelle von Standardbibliotheksfunktionen verwenden. Sie können auf zusätzliche Debug -Funktionen zugreifen, um die Zuteilungen durchzuführen, indem Sie ARENA_DEBUG definieren. Schließlich können Sie auch einen Standardwert für die Allocation -Ausrichtung angeben, indem Sie einen Wert für ARENA_DEFAULT_ALIGNMENT definieren. Beispiele finden Sie unten.
// All of these are optional
// Replace standard library functions
#define ARENA_MALLOC <stdlib_malloc_like_allocator>
#define ARENA_FREE <stdlib_free_like_deallocator>
#define ARENA_MEMCPY <stdlib_memcpy_like_copier>
// for debug functionality:
#define ARENA_DEBUG
// If you would like to change the default alignment for
// allocations:
#define ARENA_DEFAULT_ALIGNMENT <alignment_value> Es gibt auch ein Makro zur Bestimmung der Ausrichtung der Typen. Wie alles andere ist es auch C89-freundlich, obwohl es beim Kompilieren unter C11 stdalign.h alignof verwenden wird.
ARENA_ALIGNOF ( type ) // Gives alignment of `type` Der Code wurde geschrieben, um mit jedem Compiler zu erstellen, der den C89 -Standard unterstützt und auf jeder Plattform ausgeführt wird. Es gibt jedoch einige Probleme beim Aufbau von Fenstern mit dem Makefile . Bitte lesen Sie alle folgenden Informationen.
Die Tests und Beispiele wurden zusammengestellt und erfolgreich unter den folgenden Compilern und Versionen durchgeführt:
Die Tests und Beispiele wurden zusammengestellt und erfolgreich auf folgenden Betriebssystemen durchgeführt:
Beachten Sie, dass das Makefile derzeit nicht so konfiguriert wurde, dass er bei Windows beim Ausführen $ make test aufgrund der Verwendung von Valgrind und der Abwesenheit von .exe -Erweiterungen. Dies sollte eine einfache Lösung sein und auf meiner TODO -Liste steht (zögern Sie nicht, ein Problem zu öffnen und dies selbst zu beheben!).
Dieses Projekt enthält sehr einfache Richtlinien für den Beitrag.
Für alle Beiträge zum Code von arena.h öffnen Sie bitte nur eine Pull -Anfrage, wenn Sie ein Problem ansprechen , um eine Feature -Anfrage zu erfüllen oder einen Fehler zu beheben . Befolgen Sie den Codestil und führen Sie die automatisierten Tests aus, bevor Sie eine Pull -Anforderung öffnen. Alle Tests müssen bestanden werden.
Für Feature -Anfragen oder Fehler öffnen Sie bitte ein Problem . Sie können dieses Problem dann selbst angehen.
Öffnen Sie für irgendetwas anderes ein Problem und wir werden es diskutieren.
arena.hIm Moment gibt es keine Dokumentation für den Codestil, aber es sollte relativ einfach genug sein, um durch das Lesen vorhandener Code für die meisten Dinge zu lesen. Wenn Sie Probleme haben, können Sie ein Problem für ein FR eröffnen. Wenn es bereits vorhanden ist, kommentieren Sie es, um zu beschreiben, wofür Sie verwirrt sind.
Wenn Sie arena.h ändern, müssen Sie die Tests ausführen. Siehe den nächsten Abschnitt.
Wenn Sie in arena.h eine Funktion hinzufügen, müssen Sie einen angemessenen Test oder Tests innerhalb von test.c erstellen.
Wenn Sie eine Funktion in arena.h hinzufügen, müssen Sie ein angemessenes Beispiel in code_examples/ und dem makefile hinzufügen, es ist jedoch nicht erforderlich.
Wenn Sie arena.h ändern. Führen Sie die Tests durch, bevor Sie eine PR öffnen . Wenn Sie einen PR mit Änderungen am Code öffnen und die Tests nicht alle bestehen, machen Sie einen Kommentar zu Ihrem PR, in dem angegeben ist, welcher Test, von dem Sie glauben, dass es falsch ist, und verhindern Sie, dass Sie alle Tests bestehen. Wenn ein Test fehlschlägt und Ihr PR keinen Kommentar enthält, der behauptet, einen fehlgeschlagenen Test zu korrigieren, wird Ihr PR abgeschlossen ignoriert.
Außerhalb von Fehler mit Fehler und Feature -Anfragen wird eine Funktionsanforderung oder Fehlerreparatur für Funktionen in arena.h erfüllt. H ermöglicht das Ändern oder Hinzufügen eines relevanten Testcodes in test.c , und Sie müssen dies tun, wenn Sie möchten, dass Ihre PR bestätigt wird. Es gibt Dokumentation zum Testen von Code innerhalb von test.c oben in der Datei in Form von Kommentaren.
Die Tests müssen ebenfalls durch Valgrind-Leckfreie geleitet und arena.h C89-konform sein . Sie sollten dies mit dem Makefile überprüfen, aber wenn Sie aus irgendeinem Grund nicht möchten oder nicht möchten, kompilieren Sie test.c mit
-Werror -Wall -Wextra -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Wdeclaration-after-statement
Und für die Einhaltung test_compliance.c mit kompilieren
-pedantic -std=c89 -Werror -Wall -Wextra -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Wdeclaration-after-statement
Wie gesagt, Sie können das alles mit dem Makefile machen
$ make test
Kennungen
variable_name , sein. Für Zeiger sollte das Sternchen ( * ) an den Variablennamen beigefügt werden, nicht an den Typ, z. B. type *variable_name .type function_name(p1, p2, ...) , sein. Bei Zeigern sollte das Sternchen ( * ) an den Typ für Dichte angehängt werden, z. B. type* function_name(p1, p2, ...) . Funktionen sollten eine Vorwärtsdeklaration mit einem Kommentar zur obigen Dokumentation oben in der Datei abgeben. Stellen Sie sicher, dass die Bestellung relativ zu anderen Funktionen konsistent ist.struct StructName . Sie sollten typisiert und oben in der Header -Datei befinden.ARENA_ , z. B. ARENA_MACRO_NAME . Bitte vermeiden Sie es, Makros hinzuzufügen, ohne mich zuerst zu konsultieren . Fühlen Sie sich jedoch frei, Änderungen an vorhandenen Makros vorzunehmen.White Space basiert auf der Relevanz einer Codezeile für die Umgebung. Wenn Sie nicht verstehen, was diese Punkte bedeuten, schauen Sie sich bitte den Code an. Es sollte wie folgt formatiert werden:
Die Fehlerprüfung sollte nach Möglichkeit durchgeführt werden und das Verhalten von Standardbibliothek -Implementierungen nachahmen, z NULL Sie sollten eine frühzeitige Fehlerprüfung verwenden, was bedeutet, auf Fehler zu prüfen, sobald sie erzeugt werden könnten, z. Nach einem fehlgeschlagenen malloc -Anruf nach einem NULL kehrte nach.
Kommentare sollten beschreiben, warum Sie etwas getan haben, nicht was es ist, was Sie getan haben. Mit anderen Worten, Ihr Code sollte selbsterklärend sein. Die Dokumentation für Funktionen in Form von Kommentaren sollte sich im folgenden Format über der Funktion befinden:
/*
Description of function, description of function description of function.
Description of function description of function, description of function
description of function.
Parameters:
paramter1_type paramter1_name | Description of parameter 1, description
of parameter one description of paramter
1.
paramter2_type paramter2_name | Description of parameter 2, description
of parameter one description of paramter
2.
Return:
Description of return value, description of return value description of return value.
*/