Function Parameter-List with Identifiers


S

Shao Miller

Good day, respected regulars and other readers!

Quick question: At file scope, suppose we have:

extern void foo(int Bar);
void foo(int bar) { return; }

(Please note the case.) I seem to recall some bit about the former
parameter identifiers being ignored, but can't seem to find that bit.
Does anyone recall if that's so? It's not an identifier-list, but a
parameter-list.

Thank you for your time.

- Shao Miller
 
Ad

Advertisements

B

Ben Pfaff

Shao Miller said:
Quick question: At file scope, suppose we have:

extern void foo(int Bar);
void foo(int bar) { return; }

(Please note the case.) I seem to recall some bit about the former
parameter identifiers being ignored, but can't seem to find that
bit. Does anyone recall if that's so? It's not an identifier-list,
but a parameter-list.

It is so. You can even add "const" to one of the prototypes, if
you like.

(If you want, I'll look up a reference for you.)
 
S

Shao Miller

N1570 6.7.6.3p15

Thank you for your response.

Forgive me, but I don't quite follow the relevance of that paragraph.
It's discussing compatible types. Are you suggesting this piece because
of 6.7p4?
 
S

Shao Miller

It is so. You can even add "const" to one of the prototypes, if
you like.

(If you want, I'll look up a reference for you.)

Thank you for your response.

Since 'const' is a type qualifier, I'm sure you weren't referring to
N1570 6.7.6.3p13 (where 6.7.6.3p2 is relevant for that, too).

Were you suggesting this because of N1570 6.7p4 and 6.7.6.3p15; that
type compatibility is the only consideration for this particular example?
 
S

Stefan Ram

Shao Miller said:
It's discussing compatible types. Are you suggesting this piece because
of 6.7p4?

I mention it because it does not mention the parameter identifiers, and
because of 6.2.7p2.
 
Ad

Advertisements

B

Ben Pfaff

Shao Miller said:
Thank you for your response.

Since 'const' is a type qualifier, I'm sure you weren't referring to
N1570 6.7.6.3p13 (where 6.7.6.3p2 is relevant for that, too).

I don't have N1570 conveniently at hand.

I'm talking about the final sentence in paragraph 13 in C99
6.7.5.3 "Function declarators (including prototypes)":

(In the determination of type compatibility and of a
composite type, each parameter declared with function or
array type is taken as having the adjusted type and each
parameter declared with qualified type is taken as having
the unqualified version of its declared type.)
Were you suggesting this because of N1570 6.7p4 and 6.7.6.3p15; that
type compatibility is the only consideration for this particular
example?

Sorry, the lack of N1570 makes me not follow this.
 
S

Shao Miller

n1570

6.2 Concepts
6.2.1 Scopes of identifiers

4 If the declarator or type specifier
that declares the identifier appears
within the list of parameter declarations in a function prototype
(not part of a function definition),
the identifier has function prototype scope,
which terminates at the end of the function declarator.

I'm pretty sure that this is the one I was having "reader's block" or
"finder's block" with. Thanks a lot, pete!
 
Ad

Advertisements

S

Shao Miller

I don't have N1570 conveniently at hand.

I'm talking about the final sentence in paragraph 13 in C99
6.7.5.3 "Function declarators (including prototypes)":

(In the determination of type compatibility and of a
composite type, each parameter declared with function or
array type is taken as having the adjusted type and each
parameter declared with qualified type is taken as having
the unqualified version of its declared type.)


Sorry, the lack of N1570 makes me not follow this.

Right, that's the C99 counterpart. Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top