Re: struct problem
Re: struct problem
- Subject: Re: struct problem
- From: Ben Lachman <email@hidden>
- Date: Sat, 12 Apr 2008 23:30:52 -0400
On Apr 12, 2008, at 8:03 AM, Dean Ritchie wrote:
On Apr 12, 2008, at 1:37 AM, Hamish Allan wrote:
On Sat, Apr 12, 2008 at 2:58 AM, Dean Ritchie
<email@hidden> wrote:
columnCount = [[LASize cellAtIndex:0] intValue];
rowCount = [[LASize cellAtIndex:1] intValue];
When I stop right after initializing the NSRect local variable, the
debugger reports miniscule values for the portions of the
rectangle, like it
got overlaid with integers instead of float values.
Where are columnCount and rowCount declared, and as what types?
They are class variables, type int.
In general the naming convention used in Objective-C is that class
names start with capitals and variable names start with lower-case
characters (both use bumpy case which I think you know). For
instance NSWindow (class) and aWindow (variable). However in your
code you have LASize, which looks a whole lot like NSSize (which
happens to be a struct). However you're assigning sender to it which
is of type id. This introduces some confusion, since you assumedly
assign an object variable to something that looks very much like a
struct type. This may not be a bug (we don't know what type sender
or LASize are so it's hard to say), but it leaves the code nearly
unreadable for the casual observer. If you want someone to help you
out, try to post more clear code. In a more general sense, it's good
to write code that follows the general naming conventions anyway
since if you ever have to share your code or go just back and read it
in a year you'll have less work understanding it.
->Ben
--
Ben Lachman
Acacia Tree Software
http://acaciatreesoftware.com
email@hidden
740.590.0009
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden