Compile time type checking in absence of a prototype

S

Sortie

When a function call is encountered during the compile, is any
parameter or return type checking done by the compiler?
 
E

Eric Sosman

Sortie said:
When a function call is encountered during the compile, is any
parameter or return type checking done by the compiler?

Yes.

Next question ...?
 
P

Phil Carmody

Richard Heathfield said:

In the context of the subject line, "Compile time type checking
in absence of a prototype", I'd say the answer is closer to "no".
(But still pedantically "yes", as of course an implicit int will
be checked against assigning it to a pointer, say, but that's not
actually checking anything useful. I'm not sure whether you're
taking the pedantic route or simply missed the subject line, either
is understandable.)

To the OP - don't assume your subject line has been read by the
time people are reading the bodies of your posts. If there's
essential information in it, ensure you either repeat it in
the body, or draw clear attention to it in the body.

Phil
 
J

jacob navia

Eric Sosman a écrit :
Yes.

Next question ...?

This is of course wrong, since regulars play with words here to amuse
themselves misleading a person that asks a simple question.

(1) No checks can be done if there is no prototype to the arguments
being passed

(2) The return type is "int". This means that this return type will
be checked against assigning it to a structure or any other value
incompatible with an integer. That trivial check allows heathfield
and company to say "yes" (enigmatically) to demnostrate their knowledge
and to mislead the original poster.
 
N

Nick Keighley

Eric Sosman a écrit :




This is of course wrong, since regulars play with words here to amuse
themselves misleading a person that asks a simple question.

(1) No checks can be done if there is no prototype to the arguments
being passed

(2) The return type is "int". This means that this return type will
be checked against assigning it to a structure or any other value
incompatible with an integer. That trivial check allows heathfield
and company to say "yes" (enigmatically) to demnostrate their knowledge
and to mislead the original poster.

seems like a pretty standard usage of the word "yes".
The OP said "is *any* parameter or return type checing done?".
And the answert is "yes, some is done". People also explained why the
simple answer wasn't all that useful.
 
E

Eric Sosman

jacob said:
Eric Sosman a écrit :

This is of course wrong, since regulars play with words here to amuse
themselves misleading a person that asks a simple question.

Jacob, you have confused "prototype" with "declaration."
Here is a function declaration with no prototype:

char * myAuntFanny();

And here is an invocation of the function:

double trouble = myAuntFanny();

Now read the O.P.'s question again: "Is any parameter *or*
*return* *type* checking done by the compiler?"
 
B

Ben Bacarisse

jacob navia said:
Eric Sosman a écrit :

This is of course wrong, since regulars play with words here to amuse
themselves misleading a person that asks a simple question.

(1) No checks can be done if there is no prototype to the arguments
being passed

(2) The return type is "int".

The return type is not always int. The question was about absence of
prototypes not the absence of declarations.

As an advocate of C99 you would know that a return type of int can
only come from a declaration
 

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

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top