boyfarrell
Registered
Hi all.
I seem to get this error when I use a method with return type void?
Here is some code that works:
The above is a simple 'setter' for an array, which is the instance variable or Spectra class. Here is the @implemention:
However, my old code that returned void gave me the signal 11 error:
With the method:
Note the print method is just a very simple printf call calling the xColumn instance variable as you would imagine.
Clearly, I don't need this method to return anything, it's just clutters up my code! Any idea's on how to get around this quirk?
Daniel.
I seem to get this error when I use a method with return type void?
Here is some code that works:
Code:
#import <Foundation/NSObject.h>
#import <Foundation/NSAutoreleasePool.h>
#import <Foundation/NSString.h>
#import "Spectra.h"
int main(int argc, char *argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
Spectra* mySpectra;
double num = [mySpectra setElementX: 0 To: 123.0];
printf ("%lf",num);
[pool release];
return 0;
}
Code:
-(double)setElementX: (unsigned int) element To: (double) elementValue;
{
xColumn[element] = elementValue;
return xColumn[element];
}
However, my old code that returned void gave me the signal 11 error:
Code:
#import <Foundation/NSObject.h>
#import <Foundation/NSAutoreleasePool.h>
#import <Foundation/NSString.h>
#import "Spectra.h"
int main(int argc, char *argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
Spectra* mySpectra;
[mySpectra setElementX: 0 To: 123.0];
[mySpectra printElement: 0];
[pool release];
return 0;
}
Code:
-(void) setElementX: (unsigned int) element: To (double) elementValue;
{
//xColumn is the instance vaiable of the Spectra class
xColumn[element] = elementValue;
}
Clearly, I don't need this method to return anything, it's just clutters up my code! Any idea's on how to get around this quirk?
Daniel.