Re: Maximum uid and how to indicate "any user"
Re: Maximum uid and how to indicate "any user"
- Subject: Re: Maximum uid and how to indicate "any user"
- From: Greg Hurrell <email@hidden>
- Date: Tue, 12 Jul 2005 08:51:54 +0200
El 12/07/2005, a las 6:08, Mike Smith escribió:
Is there any reason that you can't simply pass another argument?
No, no reason. That's another option that I forgot to list. I was
just trying to come up with the "cleanest" API with minimal code
duplication, but "clean" is always going to be a bit subjective:
1. Single method with special value used to indicate "any user":
- (void)doSomethingWithUser:(long long)uid;
2. Separate methods, one for "any user" and another for a specified
user:
- (void)doSomething;
- (void)doSomethingWithUser:(uid_t)uid;
3. Single method with additional argument:
- (void)doSomething:(uid_t)uid anyUser:(BOOL)flag;
4. Single method with uid passed by reference, passing NULL pointer
for "any user":
- (void)doSomethingWithUser:(uid_t *)uid;
There are probably some other options too but I don't want to get
carried away listing them. For me stylistic questions often come up
like this when mixing higher-level code (written in Objective-C) with
lower-level APIs... When I first approached the problem, the first
style seemed the right way to do it, but now I am not so sure.
Cheers,
Greg _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden