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

Re: [RFR] man://manpages-de/stdarg.3



Am 21.01.2011 13:56, schrieb Bernhard R. Link:
* Chris Leick<c.leick@vollbio.de>  [110121 09:55]:
"If there is no next argument, or if I<type>   is not compatible with the type "
"of the actual next argument (as promoted according to the default argument"
"promotions), random errors will occur."
msgstr ""
"Wenn es kein weiteres Argument gibt oder wenn I<typ>   nicht kompatibel mit "
"dem Typ des n??chsten Argumentes ist (wie es entsprechend der"
"Standardargumente bef??rdert wird), erscheinen zuf??llige Fehler."
Es werden nicht die Standardargument befördert,
was ich ja auch nicht schreib ("entsprechend").

  sondern es sind die
Standardregeln wie Typen von Argumenten verändert werden.
Dass die Typen der Argumente geändert werden, kann ich hier allerdings
nicht finden. »ap« wird so geändert, dass es den Typ des nächsten
Arguments hat. Da dies fortlaufend über die ganze Liste wiederholt wird,
schlage ich vor es etwas freier mit »an der Reihe ist« zu übersetzen.
Ein Beispiel:

| #include<stdio.h>
| #include<stdarg.h>
|
| int got(int dummy, ...) {
|         short s;
|         va_list ap;
|
|         va_start(ap, dummy);
|
|         s = va_arg(ap, short);
|         va_end(ap);
|         return s;
| }
| int main() {
|         short s = 7;
|         printf("%d\n", got(0, s));
|         return 0;
| }

Wenn man das kompiliert, bekommt man folgende Fehlermeldung:
t.c: In function ‘got’:
t.c:10: warning: ‘short int’ is promoted to ‘int’ when passed through ‘...’
t.c:10: note: (so you should pass ‘int’ not ‘short int’ to ‘va_arg’)
t.c:10: note: if this code is reached, the program will abort

Das Problem ist, dass wenn man ein short als variables Argument übergibt,
es automatisch nicht als short, sondern als int übergeben wird. Diesen Vorgang
nennt man "argument promotion".

Das würde bedeuten, dass der obige Fall auf etwas als short zugreifen würde,
was ein int ist, das angegebene "short" also nicht kompatibel zu den übergebenen
Typ "short" ist, nachdem 'argument promotion' auf den Typ angewendet wurde.

Netterweise weigert sich gcc hier, dass so zu kopilieren und baut sogar ein
'abort' ein, damit man nicht ausversehen so ein Zeug baut, weil es völlig
zufällige Ergebnisse zur Folge hätte (auf little endian würde es für Ganzzahlen
vielleicht tun, auf big endian nicht, usw usf).

Ok. Dieses Fachwort war mir nicht bekannt. Ich werde Deine Formulierung übernehmen.

"[...] Some systems that do not"
"supply B<va_copy>()  have B<__va_copy>  instead, since that was the name used "
"in the draft proposal."
Einige Systeme, die kein "
"B<va_copy>() bereitstellen, haben stattdessen B<__va_copy>, da das der "
"gleiche Name ist, der im Entwurfsvorschlag benutzt wurde."
", da dies der Name ist, der im ursprünglichen Vorschlag verwendet wurde."
Draft ist ein Entwurf, ein Konzept oder eine Skizze. »Ursprünglich« passt
hier meiner Meinung nicht.
Hier ist "draft" meiner Meinung nach ein Fachterminus für eine veröffentlichte
'offiziell' herausgegebene Vorversion des C Standards, was ein gewisser Schritt
des Standardisierungsprozesses ist. Ich vermute "draft proposal" meint hier
einen Vorschlag, was in den nächsten Standard soll, sprich was in einen solchen
'draft' eingebaut werden soll, damit es in den Standard kommen kann.
All diese Konnotationen gehen bei "Entwurfsvorschlag" meiner Meinung nach
völlig verloren, so dass "Entwurfsvorschlag" aus meiner Sicht nur noch ein
komisch klingender Begriff ohne jede Bedeutung ist.

Insofern sollte es entweder soetwas wie
"[Name], der im in den Standardisierungsprozess ursprünglich
eingebrachten Vorschlag verwendet wurde"
sein oder kurz "[Name], der im ursprünglichen Vorschlag verwendet wurde."

Klingt schlüssig. Werde es übernehmen.

Gruß,
Chris
# German translation of manpages - stdarg.3.
# This file is distributed under the same license as the manpages-de package.
# Chris Leick <c.leick@vollbio.de>, 2011.
#
msgid ""
msgstr ""
"Project-Id-Version: manpages-de\n"
"POT-Creation-Date: 2010-10-22 16:24+0300\n"
"PO-Revision-Date: 2011-01-22 19:55+0100\n"
"Last-Translator: Chris Leick <c.leick@vollbio.de>\n"
"Language-Team: German <debian-l10n-german@lists.debian.org>\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

#. type: TH
#, no-wrap
msgid "STDARG"
msgstr "STDARG"

#. type: TH
#, no-wrap
msgid "2001-10-14"
msgstr "14. Oktober 2001"

#. type: TH
#, no-wrap
msgid "Linux Programmer's Manual"
msgstr "Linux-Programmierhandbuch"

#. type: SH
#, no-wrap
msgid "NAME"
msgstr "BEZEICHNUNG"

#. type: Plain text
msgid "stdarg, va_start, va_arg, va_end, va_copy - variable argument lists"
msgstr "stdarg, va_start, va_arg, va_end, va_copy - variable Argument-Listen"

#. type: SH
#, no-wrap
msgid "SYNOPSIS"
msgstr "Ã?BERSICHT"

#. type: Plain text
msgid "B<#include E<lt>stdarg.hE<gt>>"
msgstr "B<#include E<lt>stdarg.hE<gt>>"

#. type: Plain text
msgid "B<void va_start(va_list >I<ap>B<, >I<last>B<);>"
msgstr "B<void va_start( va_list >I<ap>B<, >I<letztes>B<);>"

#. type: Plain text
msgid "I<type>B< va_arg(va_list >I<ap>B<, >I<type>B<);>"
msgstr "I<type>B< va_arg( va_list >I<ap>B<, >I<typ>B<);>"

#. type: Plain text
msgid "B<void va_end(va_list >I<ap>B<);>"
msgstr "B<void va_end(va_list >I<ap>B<);>"

#. type: Plain text
msgid "B<void va_copy(va_list >I<dest>B<, va_list >I<src>B<);>"
msgstr "B<void va_copy(va_list >I<ziel>B<, va_list >I<quelle>B<);>"

#. type: SH
#, no-wrap
msgid "DESCRIPTION"
msgstr "BESCHREIBUNG"

#. type: Plain text
msgid ""
"A function may be called with a varying number of arguments of varying "
"types.  The include file I<E<lt>stdarg.hE<gt>> declares a type I<va_list> "
"and defines three macros for stepping through a list of arguments whose "
"number and types are not known to the called function."
msgstr ""
"Eine Funktion kann mit einer unterschiedlichen Anzahl von Argumenten "
"verschiedenen Typs aufgerufen werden. Die Include-Datei I<stdarg.h> "
"deklariert einen Typ B<va_list> und definiert drei Makros, um eine Liste von "
"Argumenten durchzugehen, deren Anzahl und Typen der aufgerufenen Funktion "
"unbekannt sind."

#. type: Plain text
msgid ""
"The called function must declare an object of type I<va_list> which is used "
"by the macros B<va_start>(), B<va_arg>(), and B<va_end>()."
msgstr ""
"Die aufgerufene Funktion muss ein Objekt des Typs B<va_list> deklarieren, "
"welches von den Makros B<va_start>(), B<va_arg>() und B<va_end>() benutzt "
"wird."

#. type: SS
#, no-wrap
msgid "va_start()"
msgstr "va_start()"

#. type: Plain text
msgid ""
"The B<va_start>()  macro initializes I<ap> for subsequent use by B<va_arg>"
"()  and B<va_end>(), and must be called first."
msgstr ""
"Das Makro B<va_start>() initialisiert I<ap> zur nachfolgenden Benutzung durch "
"B<va_arg>() und B<va_end>() und muss zuerst aufgerufen werden."

#. type: Plain text
msgid ""
"The argument I<last> is the name of the last argument before the variable "
"argument list, that is, the last argument of which the calling function "
"knows the type."
msgstr ""
"Das Argument I<letztes> ist der Name des letzten Arguments vor der Liste der "
"veränderlichen Argumente, das heisst, das letzt Argument, dessen Typ die "
"aufrufende Funktion kennt."

#. type: Plain text
msgid ""
"Because the address of this argument may be used in the B<va_start>()  "
"macro, it should not be declared as a register variable, or as a function or "
"an array type."
msgstr ""
"Da die Adresse dieses Parameters im Makro B<va_start>() benutzt wird, sollte "
"er nicht als eine Registervariable, als Funktion oder als ein Feldtyp "
"deklariert werden."

#. type: SS
#, no-wrap
msgid "va_arg()"
msgstr "va_arg()"

#. type: Plain text
msgid ""
"The B<va_arg>()  macro expands to an expression that has the type and value "
"of the next argument in the call.  The argument I<ap> is the I<va_list> "
"I<ap> initialized by B<va_start>().  Each call to B<va_arg>()  modifies "
"I<ap> so that the next call returns the next argument.  The argument I<type> "
"is a type name specified so that the type of a pointer to an object that has "
"the specified type can be obtained simply by adding a * to I<type>."
msgstr ""
"Das Makro B<va_arg>() expandiert zu einem Ausdruck, der den Typ und Wert des "
"nächsten aufzurufenden Argumentes hat. Das Argument I<ap> ist die B<va_list> "
"I<ap>, initialisiert durch B<va_start>(). Jeder Aufruf von B<va_arg>() "
"verändert I<ap> so, dass der folgende Aufruf das nächste Argument zurückgibt. "
"Der Parameter I<typ> ist ein Typenname, der so angegeben ist, dass der Typ "
"eines Zeigers auf ein Objekt, das den angegebenen Typ hat, einfach durch "
"Hinzufügen eines * zu I<typ> erhalten werden kann."

#. type: Plain text
msgid ""
"The first use of the B<va_arg>()  macro after that of the B<va_start>()  "
"macro returns the argument after I<last>.  Successive invocations return the "
"values of the remaining arguments."
msgstr ""
"Die erste Benutzung des Makros B<va_arg>() nach B<va_start>() gibt das "
"Argument nach I<letztes> zurück. Nachfolgende Aufrufe geben die Werte der "
"verbleibenden Argumente zurück."

#. type: Plain text
msgid ""
"If there is no next argument, or if I<type> is not compatible with the type "
"of the actual next argument (as promoted according to the default argument "
"promotions), random errors will occur."
msgstr ""
"Wenn es kein weiteres Argument gibt oder wenn I<typ> nicht kompatibel mit "
"dem Typ des tatsächlich nächsten Argumentes ist (entsprechend der üblichen "
"»argument promotions«), erscheinen zufällige Fehler."

#. type: Plain text
msgid ""
"If I<ap> is passed to a function that uses B<va_arg(>I<ap>B<,>I<type>B<)> "
"then the value of I<ap> is undefined after the return of that function."
msgstr ""
"Falls I<ap> an eine Funktion übergeben wird, die "
"B<va_arg(>I<ap>B<,>I<type>B<)> benutzt, dann ist der Wert von I<ap> nach der "
"Rückkehr dieser Funktion undefiniert."

#. type: SS
#, no-wrap
msgid "va_end()"
msgstr "va_end()"

#. type: Plain text
msgid ""
"Each invocation of B<va_start>()  must be matched by a corresponding "
"invocation of B<va_end>()  in the same function.  After the call B<va_end"
"(>I<ap>B<)> the variable I<ap> is undefined.  Multiple traversals of the "
"list, each bracketed by B<va_start>()  and B<va_end>()  are possible.  "
"B<va_end>()  may be a macro or a function."
msgstr ""
"Zu jedem Aufruf von B<va_start>() muss zu einen zugehörigen Aufruf von "
"B<va_end>() in der gleichen Funktion geben. Nach dem Aufruf "
"B<va_end(>I<ap>B<)> ist die Variable I<ap> undefiniert. Es sind mehrere "
"Durchläufe der Liste möglich, jeweils von B<va_start>() und B<va_end>() "
"eingeschlossen. B<va_end>() kann ein Makro oder eine Funktion sein."

#. type: SS
#, no-wrap
msgid "va_copy()"
msgstr "va_copy()"

#.  Proposal from clive@demon.net, 1997-02-28
#. type: Plain text
# http://www.a-m-i.de/tips/stack/stack.php
# http://de.wikipedia.org/wiki/Variadische_Funktion
msgid ""
"An obvious implementation would have a I<va_list> be a pointer to the stack "
"frame of the variadic function.  In such a setup (by far the most common) "
"there seems nothing against an assignment"
msgstr ""
"Eine naheliegende Implementierung hätte eine I<va_list>, die ein Zeiger in "
"den »Stack-Frame« der variadischen Funktion wäre. In einem derartigen "
"Szenario (dem bei weitem üblichsten) scheint nichts gegen folgende Zuweisung "
"zu sprechen"

#. type: Plain text
#, no-wrap
msgid "va_list aq = ap;\n"
msgstr "va_list aq = ap;\n"

#. type: Plain text
msgid ""
"Unfortunately, there are also systems that make it an array of pointers (of "
"length 1), and there one needs"
msgstr ""
"Leider gibt es auch Systeme, die es als Feld von Zeigern (der Länge 1) "
"anlegen und ein solches benötigen."

#. type: Plain text
#, no-wrap
msgid ""
"va_list aq;\n"
"*aq = *ap;\n"
msgstr ""
"va_list aq;\n"
"*aq = *ap;\n"

#. type: Plain text
msgid ""
"Finally, on systems where arguments are passed in registers, it may be "
"necessary for B<va_start>()  to allocate memory, store the arguments there, "
"and also an indication of which argument is next, so that B<va_arg>()  can "
"step through the list.  Now B<va_end>()  can free the allocated memory "
"again.  To accommodate this situation, C99 adds a macro B<va_copy>(), so "
"that the above assignment can be replaced by"
msgstr ""
"Zu guter Letzt kann es auf Systemen, die Argumente in Registern übergeben, "
"nötig sein, dass B<va_start> Speicher reserviert und in diesem die Argumente "
"und einen Positionsanzeiger speichert, so dass B<va_arg>() diese Liste "
"durchschreiten kann. Dann kann "
"B<va_end>() den reservierten Speicher wieder freigeben. Um dieser Situation "
"Rechnung zu tragen, fügt C99 ein Makro B<va_copy>() hinzu, so dass obige "
"Zuweisung durch Folgendes ersetzt werden kann"

#. type: Plain text
#, no-wrap
msgid ""
"va_list aq;\n"
"va_copy(aq, ap);\n"
"\\&...\n"
"va_end(aq);\n"
msgstr ""
"va_list aq;\n"
"va_copy(aq, ap);\n"
"\\&...\n"
"va_end(aq);\n"

#. type: Plain text
msgid ""
"Each invocation of B<va_copy>()  must be matched by a corresponding "
"invocation of B<va_end>()  in the same function.  Some systems that do not "
"supply B<va_copy>()  have B<__va_copy> instead, since that was the name used "
"in the draft proposal."
msgstr ""
"Zu jedem Aufruf von B<va_copy>() muss zu einen zugehörigen Aufruf von "
"B<va_end>() in der gleichen Funktion geben. Einige Systeme, die kein "
"B<va_copy>() bereitstellen, haben stattdessen B<__va_copy>, da das der "
"gleiche Name ist, der im ursprünglichen Vorschlag benutzt wurde."

#. type: SH
#, no-wrap
msgid "CONFORMING TO"
msgstr "KONFORM ZU"

#. type: Plain text
msgid ""
"The B<va_start>(), B<va_arg>(), and B<va_end>()  macros conform to C89.  C99 "
"defines the B<va_copy>()  macro."
msgstr ""
"Die Makros B<va_start>(), B<va_arg>() und B<va_end>() sind konform zu C89. "
"C99 definiert das Makro B<va_copy>()."

#. type: SH
#, no-wrap
msgid "NOTES"
msgstr "ANMERKUNGEN"

#. type: Plain text
msgid ""
"These macros are I<not> compatible with the historic macros they replace.  A "
"backward compatible version can be found in the include file I<E<lt>varargs."
"hE<gt>>."
msgstr ""
"Diese Makros sind I<nicht> kompatibel mit den historischen Makros, die sie "
"ersetzen. Eine abwärtskompatible Version kann in der Include-Datei "
"I<E<lt>varargs.hE<gt>> gefunden werden."

#. type: Plain text
msgid "The historic setup is:"
msgstr "Die historische Einstellung ist:"

#. type: Plain text
#, no-wrap
msgid "#include E<lt>varargs.hE<gt>\n"
msgstr "#include E<lt>varargs.hE<gt>\n"

#. type: Plain text
#, no-wrap
msgid ""
"void\n"
"foo(va_alist)\n"
"    va_dcl\n"
"{\n"
"    va_list ap;\n"
msgstr ""
"void\n"
"foo(va_alist)\n"
"    va_dcl\n"
"{\n"
"    va_list ap;\n"

#. type: Plain text
#, no-wrap
msgid ""
"    va_start(ap);\n"
"    while (...) {\n"
"        ...\n"
"        x = va_arg(ap, type);\n"
"        ...\n"
"    }\n"
"    va_end(ap);\n"
"}\n"
msgstr ""
"    va_start(ap);\n"
"    while (...) {\n"
"        ...\n"
"        x = va_arg(ap, type);\n"
"        ...\n"
"    }\n"
"    va_end(ap);\n"
"}\n"

#. type: Plain text
msgid ""
"On some systems, I<va_end> contains a closing \\(aq}\\(aq matching a \\(aq"
"{\\(aq in I<va_start>, so that both macros must occur in the same function, "
"and in a way that allows this."
msgstr ""
"Auf einigen Systemen enthält I<va_end> eine abschlie�ende »}«, die zu einer "
"»{« in I<va_start> passt, so dass beide Makros in der gleichen Funktion "
"auf eine Weise erscheinen müssen, die dies möglicht."

#. type: SH
#, no-wrap
msgid "BUGS"
msgstr "FEHLER"

#. type: Plain text
msgid ""
"Unlike the B<varargs> macros, the B<stdarg> macros do not permit programmers "
"to code a function with no fixed arguments.  This problem generates work "
"mainly when converting B<varargs> code to B<stdarg> code, but it also "
"creates difficulties for variadic functions that wish to pass all of their "
"arguments on to a function that takes a I<va_list> argument, such as "
"B<vfprintf>(3)."
msgstr ""
"Im Gegensatz zu den Makros B<varargs> erlauben die Makros B<stdarg> dem "
"Programmierer nicht, eine Funktion ohne feste Argumente zu implementieren.  "
"Das ist hauptsächlich ein Problem, wenn man Code mit B<varargs> nach "
"B<stdarg> konvertiert, aber es erzeugt auch Schwierigkeiten bei "
"veränderlichen Funktionen die wünschen, ihre Argumente an eine Funktion "
"weiterzugeben, die ein Argument B<va_list> aufnimmt, so wie B<vfprintf>(3)."

#. type: SH
#, no-wrap
msgid "EXAMPLE"
msgstr "BEISPIEL"

#. type: Plain text
msgid ""
"The function I<foo> takes a string of format characters and prints out the "
"argument associated with each format character based on the type."
msgstr ""
"Die Funktion I<foo> nimmt eine Zeichenkette von Formatzeichen entgegen und "
"gibt für jedes Zeichen ein Argument des entsprechenden Typs aus."

#. type: Plain text
#, no-wrap
msgid ""
"#include E<lt>stdio.hE<gt>\n"
"#include E<lt>stdarg.hE<gt>\n"
msgstr ""
"#include E<lt>stdio.hE<gt>\n"
"#include E<lt>stdarg.hE<gt>\n"

#. type: Plain text
#, no-wrap
msgid ""
"void\n"
"foo(char *fmt, ...)\n"
"{\n"
"    va_list ap;\n"
"    int d;\n"
"    char c, *s;\n"
msgstr ""
"void\n"
"foo(char *fmt, ...)\n"
"{\n"
"    va_list ap;\n"
"    int d;\n"
"    char c, *s;\n"

#. type: Plain text
#, no-wrap
msgid ""
"    va_start(ap, fmt);\n"
"    while (*fmt)\n"
"        switch (*fmt++) {\n"
"        case \\(aqs\\(aq:              /* string */\n"
"            s = va_arg(ap, char *);\n"
"            printf(\"string %s\\en\", s);\n"
"            break;\n"
"        case \\(aqd\\(aq:              /* int */\n"
"            d = va_arg(ap, int);\n"
"            printf(\"int %d\\en\", d);\n"
"            break;\n"
"        case \\(aqc\\(aq:              /* char */\n"
"            /* need a cast here since va_arg only\n"
"               takes fully promoted types */\n"
"            c = (char) va_arg(ap, int);\n"
"            printf(\"char %c\\en\", c);\n"
"            break;\n"
"        }\n"
"    va_end(ap);\n"
"}\n"
msgstr ""
"    va_start(ap, fmt);\n"
"    while (*fmt)\n"
"        switch (*fmt++) {\n"
"        case \\(aqs\\(aq:              /* Zeichenkette */\n"
"            s = va_arg(ap, char *);\n"
"            printf(\"string %s\\en\", s);\n"
"            break;\n"
"        case \\(aqd\\(aq:              /* Ganzzahl */\n"
"            d = va_arg(ap, int);\n"
"            printf(\"int %d\\en\", d);\n"
"            break;\n"
"        case \\(aqc\\(aq:              /* Zeichen */\n"
"            /* hier wird eine Typumwandlung benötigt, da va_arg\n"
"               nur vollständig unterstützte Typen aufnimmt */\n"
"            c = (char) va_arg(ap, int);\n"
"            printf(\"Zeichen %c\\en\", c);\n"
"            break;\n"
"        }\n"
"    va_end(ap);\n"
"}\n"

#. type: SH
#, no-wrap
msgid "COLOPHON"
msgstr "KOLOPHON"

#. type: Plain text
msgid ""
"This page is part of release 3.27 of the Linux I<man-pages> project.  A "
"description of the project, and information about reporting bugs, can be "
"found at http://www.kernel.org/doc/man-pages/.";
msgstr ""
"Diese Seite ist Teil der Veröffentlichung 3.27 des Projekts Linux-I<man-"
"pages>. Eine Beschreibung des Projekts und Informationen, wie Fehler "
"gemeldet werden können, finden sich unter http://www.kernel.org/doc/man-";
"pages/."

Reply to: