• 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: Just starting off in obj C
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Just starting off in obj C


  • Subject: Re: Just starting off in obj C
  • From: Ian Joyner <email@hidden>
  • Date: Sat, 25 Oct 2008 16:57:22 +1100

On 25/10/2008, at 1:43 PM, Bill Bumgarner wrote:

On Oct 24, 2008, at 7:14 PM, Ian Joyner wrote:
On 25/10/2008, at 9:16 AM, Alexander von Below wrote:
Am 25.10.2008 um 00:10 schrieb Michael:
The correct statement would be:

NSLog(@"This is %@", mytest());

Thanks Alex. That, ashamedly, I should have figured out!!! :-)
Actually, no. Really the compiler should have figured it out, but ...
Quite right. C compilers are really lazy. It goes back to developing compilers to work on machines with 8K of RAM (or something like that!). Just remember that in C, Michael, you are dealing with a very arcane and archaic language. (Objective-C is the best flavour of it though, even though it is very preprocessorish).

They are only as lazy as you allow them to be. In Objective-C, avoiding the (id) type will generally lead to a relatively type safe compilation experience.

I didn't really mean lazy in that sense. Dynamic binding is desirable and by design. Rather that C compilers require a call operator '()' to tell them what to do, whereas other languages work that out (except COBOL and FORTRAN which need CALL). And things like dereferencing either by '.' or '->' because C compilers can't be bothered seeing if the variable is simple or pointer. Call is the common case, generating a function reference is the rare case (especially in OO languages, which at least hides this implementation in dispatch tables). Loads of other junk in there that makes C a verbose language that exposes implementation and increases software brittleness.



In this particular situation, the compiler is currently unable to typecheck the arguments to NSLog(). However, the compiler does a fine job with fprintf()/sprintf()/printf(), etc...


There is some subtlety to supporting NSLog() validation, which is why it isn't validated yet.

It is tracked in <rdar://problem/5195437>.

b.bum _______________________________________________
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Just starting off in obj C
      • From: Bill Bumgarner <email@hidden>
References: 
 >Just starting off in obj C (From: Michael <email@hidden>)
 >Re: Just starting off in obj C (From: Paul Russell <email@hidden>)
 >Re: Just starting off in obj C (From: Alexander von Below <email@hidden>)
 >Re: Just starting off in obj C (From: Ian Joyner <email@hidden>)
 >Re: Just starting off in obj C (From: Bill Bumgarner <email@hidden>)

  • Prev by Date: Re: Project Find - Replace Fails Silently - Watch Movie!
  • Next by Date: Re: Console littered by Xcode 3.1.1 garbage collection messages
  • Previous by thread: Re: Just starting off in obj C
  • Next by thread: Re: Just starting off in obj C
  • Index(es):
    • Date
    • Thread