Re: struct problem
Re: struct problem
- Subject: Re: struct problem
- From: Dean Ritchie <email@hidden>
- Date: Sun, 13 Apr 2008 05:21:47 -0700
On Apr 12, 2008, at 8:30 PM, Ben Lachman wrote:
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.
Thanks for the advice--I'll try to follow it more carefully. I should
have included the declarations, in my .h file, to make the example
clearer to all.
In the meantime, I have gone on to explore the question, and I may
have discovered a problem with the debugger. Perhaps the list can
advise me:
If I insert the following code into my program, with a breakpoint
immediately following, the debugger shows ridiculous values for the
elements of aRect.
NSRect aRect;
aRect.origin.x = 310.0;
aRect.origin.y = 15.0;
aRect.size.width = 100.0;
aRect.size.height= 100.0;
When I sent my original posting, I was trying to discover how the
structure had been corrupted. It appears to me now that it hadn't
been corrupted at all, but was being misreported by GDB. Should I
submit a bug report?
Dean Ritchie
_______________________________________________
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