Click here to Skip to main content
15,905,563 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi freinds!
what this signature significance?

C#
void interrupt (*oldisr)(...);


I m not understaing whats the meninig of (...),Why the dots are paassed as function argument.
Posted

elipses (...) as function arguments means that the function takes a variable argument list - i.e. it can take any number of parameters of arbitrary types. Unfortunately you can't process any of the arguments as you haven't got a named parameter in the arguments list. In this case it looks like whoever's using it is telling the compiler to not bother generating code to remove parameters from the stack as it's an interrupt handler.

This sort of thing turns up a fair bit in C (well, generally with one named argument) but generally in C++ you don't tend to use it. If you want variable arguments in C++ you tend to use overloading and chaining (the way the stream insertion and extraction operators work) as this keeps type safety.

Cheers,

Ash

PS: If you want more information about processing variable argument lists then look up the macros va_list, va_start, va_arg and va_end in your compiler's documentation, textbook or online.
 
Share this answer
 
(...) means any arguments of the function.
interrupt means something like stdcall (stack cleaning method).
 
Share this answer
 
Even in c++ the ellipsis has a dedicated use. I know of two: catching of undefined exceptions, or usage of the fact that it is the worst match for overload resolution - useful for metaprogramming trickery.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900