Go Down

Topic: Is it possible to end a program forcefully? (Read 1 time) previous topic - next topic

retrolefty

Quote
When I give my function declaration or definition is there any difference whether or not I put void in the parameter list or if I just use empty parenthesis?  I know both will compile.  But is there any larger reason to put the second void in there in the definition or declaration?


Unfortunately I'm far from being a C/C++ expert, I like hardware much better. I think the use of void function_name(void) is the formal method but void function_name() seems to be an acceptable default. I would bet that varies with the C/C++ standard the compiler is working with and most likely has changed over time and newer compiler standards. But wait for a real expert to know for sure. In the mean time use what works is my motto.  :D

Lefty

WizenedEE

I think the abort function is exactly what OP is looking for. It's a library function that does essentially what the stopSketch() function posted does.

PaulS

Quote
But is there any larger reason to put the second void in there in the definition or declaration?

The void in the parentheses after the function name says that you have thought about the list of arguments, and have decided that there are none, so you are explicitly telling the compiler that.

The empty set of parentheses implicitly says that there are no arguments. The resulting object module is exactly the same.

Go Up