Method parameters (void) vs no void declaration (error from compiler)

objective-c

Solution

You cannot do this for Objective-C.

In Objective-C, every parameter must be after `:` e.g.

- (void)someMethod:(int)i;
- (void)someMethod:(int)i withString:(NSString *)string;
- (void)someMethod:(int)i :(int)i2 :(int)i3; // you can do this but is bad style

and it does not make sense to make something like

- (void)someMethod:(void)what_goes_here;

so if you want a method without parameter:

- (void)someMethod;

However you can do it in C/C++

void someMethod(void);

And I didn't see any benefit of declare void parameters (explicitly declare things is not always good).

Problem

Why the compiler gives an error in this case of method declaration - ``` -(void) someMethod (void); ``` But approves this - ``` -(void) someMethod; ``` (SomeClass.h) I've read that it is better to declare (void) in parameters than not declaring, but probalby I miss some point.

Original source