• 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
Weird Apple Sample code
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Weird Apple Sample code


  • Subject: Weird Apple Sample code
  • From: Ruotger Skupin <email@hidden>
  • Date: Thu, 13 Dec 2007 13:38:50 +0100

Hi,

I stumpled over weird Apple sample code. It is in the CocoaHTTPServer example project (file: HTTPServer.m:7) of an Xcode 3 installation. Can someone give an explanation what this is doing?

@implementation HTTPServer

- (id)init {
    connClass = [HTTPConnection self];
    return self;
}

....

Obviously not returning the class you ask for is evil IMHO , but I could live with it if I understood the rest of that method. There's more (line 56):

@implementation HTTPConnection

- (id)init {
    [self dealloc];
    return nil;
}

....

The sample code doesn't seem to work anyway, so maybe someone just committed a broken edit to the repository?

Another question is: Should Apple really publish example code that looks like this?

Roddi

_______________________________________________

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


  • Follow-Ups:
    • Re: Weird Apple Sample code
      • From: "Sherm Pendley" <email@hidden>
    • Re: Weird Apple Sample code
      • From: Ruotger Skupin <email@hidden>
    • Re: Weird Apple Sample code
      • From: "Clark Cox" <email@hidden>
  • Prev by Date: Re: add menu
  • Next by Date: Re: Weird Apple Sample code
  • Previous by thread: Re: Setting NSColorPanel to affect NSBackgroundColorAttributeName
  • Next by thread: Re: Weird Apple Sample code
  • Index(es):
    • Date
    • Thread