MyClass.m

@implementation MyClass

- (void)method
{
#ifdef A
A stuff
#else idfef B
B stuff
#endif
}
@end

So I have conditional code, switched at compile time, which is just fine. However I have actually many more ifdefs (each representing an operating system) and the code got unreadable.

I want to find a good way to split this in MyClass-A, MyClass-B, etc by adding the least possible logic and especially keeping everything static ad build time (not runtime).

I thought of extending the class

MyClass(A)

-(void)methodA{}

and then in the MyClass udate doing something:
- (void)method
{
#ifdef A
[self methodA];
#else idfef B
[self methodB]
#endif
}

But hits is bogus: "MyClass" gets instantiated, nothing is known about methodA and thus an exception will be thrown.


Can this method be refined? Or do you have different suggestions?


Riccardo

_______________________________________________
Discuss-gnustep mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnustep

Reply via email to