| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
This program looks much better. I have just one suggestion relating to style
(see below).
On 1/1/06 5:12 AM, "Jordan Evans" <email@hidden> wrote:
> @interface Engine : NSObject
> {
> NSMutableArray *enginePartsArray;
> }
>
> - (id)init;
> - (void)maintenance:(NSMutableIndexSet*)badParts;
>
> @end
>
>
> @implementation Engine
>
> - (id)init;
> {
> int i;
>
> [super init];
>
> enginePartsArray = [[NSMutableArray alloc] init];
>
> [enginePartsArray addObject:[[CombustionChamber
> alloc] init]];
> [enginePartsArray addObject:[[Compressor alloc]
> init]];
> [enginePartsArray addObject:[[FuelInjector alloc]
> init]];
> [enginePartsArray addObject:[[FuelInjector alloc]
> init]];
> [enginePartsArray addObject:[[Shaft alloc] init]];
> [enginePartsArray addObject:[[Turbine alloc] init]];
> for( i=0; i<[enginePartsArray count]; i++ )
> [[enginePartsArray objectAtIndex:i] release];
Explicit loops are inelegant. I would suggest replacing the line above with:
[enginePartsArray makeObjectsPerformSelector:@selector(release)];
Greg
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden
This email sent to email@hidden
| References: | |
| >RE: Memory Management: Revamped Engine Example (From: Jordan Evans <email@hidden>) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.