3

I am reading Pro C#. It says

do be aware that the value 0 is automatically returned, even if you construct a Main() method prototyped to return void.

What does prototyped mean in this context?

The only C# related definition of a prototype I'm aware of has to do with a model or test program tossed together without the intention to go to production.

  • What about javascript prototypes? Ever hear about them? – Oded Dec 14 '11 at 15:33
  • @Oded oh yea, sure. Though, that certainly doesn't apply here. – P.Brian.Mackey Dec 14 '11 at 15:34
  • Just making the point ;) – Oded Dec 14 '11 at 15:34
6

In this context, I believe the phrase is used a as synonym to a method signature.

You can call any method signature the prototype of the actual call.

A bit of a throwback to c and header files.

See wikipedia - Function prototype:

A function prototype in C, Perl or C++ is a declaration of a function that omits the function body but does specify the function's return type, name, arity and argument types. While a function definition specifies what a function does, a function prototype can be thought of as specifying its interface.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.