<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="de">
	<id>https://satyria.de/arm/index.php?action=history&amp;feed=atom&amp;title=Makros</id>
	<title>Makros - Versionsgeschichte</title>
	<link rel="self" type="application/atom+xml" href="https://satyria.de/arm/index.php?action=history&amp;feed=atom&amp;title=Makros"/>
	<link rel="alternate" type="text/html" href="https://satyria.de/arm/index.php?title=Makros&amp;action=history"/>
	<updated>2026-06-24T09:22:11Z</updated>
	<subtitle>Versionsgeschichte dieser Seite in C und Assembler mit Raspberry</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>https://satyria.de/arm/index.php?title=Makros&amp;diff=499&amp;oldid=prev</id>
		<title>Satyria: /* Fazit */</title>
		<link rel="alternate" type="text/html" href="https://satyria.de/arm/index.php?title=Makros&amp;diff=499&amp;oldid=prev"/>
		<updated>2024-09-24T06:53:14Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Fazit&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;de&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Nächstältere Version&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Version vom 24. September 2024, 07:53 Uhr&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l37&quot;&gt;Zeile 37:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 37:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Fazit ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Fazit ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Makroprogrammierung mit dem GNU C-Compiler ist eine leistungsfähige Möglichkeit, wiederholbaren Code zu kapseln, bedingte Kompilierung zu verwenden und die Performance zu verbessern. Allerdings sollte sie mit Vorsicht eingesetzt werden, um Fehler und schwer nachvollziehbaren Code zu vermeiden.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Makroprogrammierung mit dem GNU C-Compiler ist eine leistungsfähige Möglichkeit, wiederholbaren Code zu kapseln, bedingte Kompilierung zu verwenden und die Performance zu verbessern. Allerdings sollte sie mit Vorsicht eingesetzt werden, um Fehler und schwer nachvollziehbaren Code zu vermeiden.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;-----&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;{| style=&quot;width: 100%;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;| style=&quot;width: 33%;&quot; | [[Bedingte Kompilierung|&amp;lt; Zurück (Bedingte Kompilierung)]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;| style=&quot;width: 33%; text-align:center;&quot; | [[Hauptseite|&amp;lt; Hauptseite &amp;gt;]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;| style=&quot;width: 33%; text-align:right;&quot; | [[Kommentare|Weiter (Kommentare) &amp;gt;]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;|}&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Satyria</name></author>
	</entry>
	<entry>
		<id>https://satyria.de/arm/index.php?title=Makros&amp;diff=470&amp;oldid=prev</id>
		<title>Satyria: Die Seite wurde neu angelegt: „Makroprogrammierung in C mit dem GNU C-Compiler (GCC) ermöglicht es, durch sogenannte Präprozessor-Makros wiederverwendbaren Code zu definieren, bevor die eigentliche Kompilierung stattfindet. Der Präprozessor in C führt Textersetzungen durch und wird oft für einfache, aber leistungsstarke Abstraktionen genutzt.  == Grundlagen der Makroprogrammierung == Makros in C werden mit dem Schlüsselwort &#039;&#039;&#039;#define&#039;&#039;&#039; definiert und sind im Wesentlichen Texters…“</title>
		<link rel="alternate" type="text/html" href="https://satyria.de/arm/index.php?title=Makros&amp;diff=470&amp;oldid=prev"/>
		<updated>2024-09-19T18:36:43Z</updated>

		<summary type="html">&lt;p&gt;Die Seite wurde neu angelegt: „Makroprogrammierung in C mit dem GNU C-Compiler (GCC) ermöglicht es, durch sogenannte Präprozessor-Makros wiederverwendbaren Code zu definieren, bevor die eigentliche Kompilierung stattfindet. Der Präprozessor in C führt Textersetzungen durch und wird oft für einfache, aber leistungsstarke Abstraktionen genutzt.  == Grundlagen der Makroprogrammierung == Makros in C werden mit dem Schlüsselwort &amp;#039;&amp;#039;&amp;#039;#define&amp;#039;&amp;#039;&amp;#039; definiert und sind im Wesentlichen Texters…“&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Neue Seite&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Makroprogrammierung in C mit dem GNU C-Compiler (GCC) ermöglicht es, durch sogenannte Präprozessor-Makros wiederverwendbaren Code zu definieren, bevor die eigentliche Kompilierung stattfindet. Der Präprozessor in C führt Textersetzungen durch und wird oft für einfache, aber leistungsstarke Abstraktionen genutzt.&lt;br /&gt;
&lt;br /&gt;
== Grundlagen der Makroprogrammierung ==&lt;br /&gt;
Makros in C werden mit dem Schlüsselwort &amp;#039;&amp;#039;&amp;#039;#define&amp;#039;&amp;#039;&amp;#039; definiert und sind im Wesentlichen Textersetzungen. Sie können entweder einfache Werte, komplexe Ausdrücke oder sogar Codeblöcke umfassen.&lt;br /&gt;
&lt;br /&gt;
=== Einfache Makros ===&lt;br /&gt;
Ein einfaches Makro ersetzt einen konstanten Wert oder Ausdruck:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#define PI 3.14159&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Überall im Code, wo &amp;#039;&amp;#039;&amp;#039;PI&amp;#039;&amp;#039;&amp;#039; steht, wird es durch 3.14159 ersetzt, bevor der Code kompiliert wird.&lt;br /&gt;
&lt;br /&gt;
=== Funktionsähnliche Makros ===&lt;br /&gt;
Funktionsähnliche Makros verhalten sich wie Funktionen, allerdings ohne den Overhead eines Funktionsaufrufs:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#define MAX(a, b) ((a) &amp;gt; (b) ? (a) : (b))&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Hier vergleicht das Makro &amp;#039;&amp;#039;&amp;#039;MAX&amp;#039;&amp;#039;&amp;#039; zwei Werte und gibt den größeren zurück. Beachte die Klammern um die Parameter und den gesamten Ausdruck, um unerwünschte Effekte durch Operator-Präzedenz zu vermeiden.&lt;br /&gt;
&lt;br /&gt;
== Vorteile von Makros ==&lt;br /&gt;
* Leistung: Da Makros auf Textebene expandieren, vermeiden sie den Funktionsaufruf-Overhead, was bei kleinen, oft aufgerufenen Funktionen nützlich sein kann.&lt;br /&gt;
* Code-Wiederverwendbarkeit: Makros bieten eine einfache Möglichkeit, wiederverwendbare Codefragmente zu erstellen.&lt;br /&gt;
== Nachteile ==&lt;br /&gt;
* Keine Typprüfung: Da Makros nur Textersetzungen sind, bieten sie keine Typprüfung wie Funktionen. Fehler können schwer zu diagnostizieren sein, da die Präprozessor-Ausgabe nicht immer klar ist.&lt;br /&gt;
* Schwierig zu debuggen: Wenn ein Fehler in einem Makro auftritt, ist es oft schwerer nachzuvollziehen, wo der eigentliche Fehler liegt, da der Makrocode nicht explizit im Quelltext erscheint.&lt;br /&gt;
&lt;br /&gt;
== GCC-spezifische Erweiterungen ==&lt;br /&gt;
GCC bietet einige erweiterte Makrofunktionen, die nicht Teil des standardmäßigen C-Präprozessors sind:&lt;br /&gt;
&lt;br /&gt;
* Variadische Makros: Diese ermöglichen es, eine variable Anzahl von Argumenten zu übergeben:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#define DEBUG_PRINT(fmt, ...) \&lt;br /&gt;
    fprintf(stderr, fmt, __VA_ARGS__)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
== Fazit ==&lt;br /&gt;
Makroprogrammierung mit dem GNU C-Compiler ist eine leistungsfähige Möglichkeit, wiederholbaren Code zu kapseln, bedingte Kompilierung zu verwenden und die Performance zu verbessern. Allerdings sollte sie mit Vorsicht eingesetzt werden, um Fehler und schwer nachvollziehbaren Code zu vermeiden.&lt;/div&gt;</summary>
		<author><name>Satyria</name></author>
	</entry>
</feed>