• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Bad Assembly Code Generation?[solved]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bad Assembly Code Generation?[solved]


  • Subject: Re: Bad Assembly Code Generation?[solved]
  • From: Kyle Moffett <email@hidden>
  • Date: Tue, 3 Sep 2002 18:10:38 -0400

On Sunday, September 1, 2002, at 01:50 AM, Joe Osborn wrote:
GCC was incapable of generating proper assembly code because i didn't declare the methods, which took and returned c data types, in my @interfaces. So it assumed objects were involved(but wouldn't something like that(that being [self setBar:[self bar]+1]; throw an 'invalid operand to binary +' or some such? ah well). Anyway, it's all working just hunky-dory now.

It thought you were doing pointer addition, which is perfectly
reasonable. Let me show you:

/* The following is structurally equivalent to a
basic object (id) under the objective-c runtime */
typedef struct {
Class *isa
} objid;
typedef objid *id;

id myid = [self bar]; /* This is the default return type */
myid = myid+1; /* Since this is pointer arithmetic,
and the size of objid is 2 (1 ptr), this adds 2 */
[self setBar:myid]; /* The result is, bar += 2; */

Hope That Helps,
Kyle Moffett
_______________________________________________
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.

References: 
 >Re:Bad Assembly Code Generation?[solved] (From: Joe Osborn <email@hidden>)

  • Prev by Date: Re: cString deprecated!
  • Next by Date: _NSAppleScript, ASKScript, or NSAppleScript?
  • Previous by thread: Re:Bad Assembly Code Generation?[solved]
  • Next by thread: Re: AppKit now thread-safe?
  • Index(es):
    • Date
    • Thread