Re: Newbie (EXE_BAD_ACCESS?)
Re: Newbie (EXE_BAD_ACCESS?)
- Subject: Re: Newbie (EXE_BAD_ACCESS?)
- From: Nick Zitzmann <email@hidden>
- Date: Sat, 22 Mar 2003 19:48:43 -0800
On Saturday, March 22, 2003, at 08:51 AM, Bernard Banks wrote:
I have a program that draws on NSView myView with drawRect. I am
trying to
include a toy subroutine to draw a line in myView by using a class
method
+(void)drawLine:(float)X:(float)Y defined in the subclass Line.h and
Line.m
of NSObj. In drawRect I make the call [Line drawLine:100.0:100.0]. In
compiling, I get two warnings, 1) invalid receiver type 'void (short
int,short int)', and 2) passing arg 1 of pointer to function from
incompatible pointer type.
Under debug, the program chokes at [Line drawLine:100.0:100.0] and
gives me
the EXE_BAD_ACCESS error. If this line is left out the program runs
with no
problem.
You're getting this error because the compiler is casting the numbers
in your +drawLine call as integers and not floats. The BAD_ACCESS error
you're getting is basically a segmentation fault, which indicates a
memory problem.
Try forcing the compiler to cast those numbers as floats instead of
ints. If calling [Line drawLine:(float)100.0:(float)100.0] doesn't
work, this might:
float number = 100.0;
[Line drawLine:number:number];
Nick Zitzmann
AIM/iChat: dragonsdontsleep
Check out my software page:
http://dreamless.home.attbi.com/
Smile! It confuses people!
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.