*bar und bar[], wo im Standard?
-
Ich weiß, das folgendes das selbe ist:
void foo (int *bar);
void foo (int bar[]);
Aber kann mir einer den Abschnitt nennen, wo das im Standard definiert ist?
-
8.3.5§3
-
Ich habe nur den c99-Draft, und in dem gibt es kein 8...
Also habe ich mal den C++-Draft angesehen und da steht an besagter Stelle:
If the type of a parameter includes a type of the form "pointer to
array of unknown bound of T" or "reference to array of unknown bound
of T," the program is ill-formed.3) Functions shall not have a return
type of type array or function, although they may have a return type
of type pointer or reference to such things. There shall be no arrays
of functions, although there can be arrays of pointers to functions.
Types shall not be defined in return or parameter types. The type of
a parameter or the return type for a function declaration that is not
a definition may be an incomplete class type.Irndwie ist das nicht das, was ich gesucht habe, oder habe ich den Text nur falsch verstanden?
-
Ich habe nur den c99-Draft, und in dem gibt es kein 8...
Ups, hab mich in der Sprache vertan. In C99 ist das lt. meinem Draft 6.7.5.2§6:
A
declaration of a parameter asarray of type'' shall be adjusted to
pointer to type'', and a declaration of a
parameter asfunction returning type'' shall be adjusted to
pointer to function returning type'', as in 6.3.2.1.Ich weiß nicht, welchen C++-Draft du hast, aber legen wir mal diesen zu Grunde:
http://anubis.dkuug.dk/jtc1/sc22/open/n2356/After determining the type of each
parameter, any parameter of type "array of T" or "function returning
T" is adjusted to be "pointer to T" or "pointer to function returning
T," respectively.