Hi Ulrich,

Thanks for your reply.

That for sure increased my understanding about the "hook"s a lot.

I think what I really want to know is the latter one, i.e. " what the
routine is supposed to do?". To reorganize the question, what is sk-
>sk_write_space usually supposed to do?



On Jan 28, 12:16 am, "Ulrich Windl" <ulrich.wi...@rz.uni-
regensburg.de> wrote:
> On 27 Jan 2010 at 9:59, Jack Z wrote:
>
> > Hi Ulrich,
>
> > Thanks for your comment.
>
> > So by "implement polymorphism", do you mean sk->sw_write_space is
> > platform dependent or it does different jobs when called from
> > different functions in the open-iscsi code?
>
> Hi,
>
> I mean: If you call a routine indirect through a function pointer, the
> reason is that you want to call different routines at runtime.
> Otherwise this is unnecessary and shows poor performance.
>
> So if calling different routines through a pointer, there must exist a
> common expectation what the code being called does (i.e. the common
> subset of expectations that every possible routine fulfills).
>
> [If you want to look it up somewhere else, try "dynamic binding",
> "polymorphism" or Bertrand Meyers "Object-Oriented software
> construction"]
>
> Therefore you should not ask which specific routine will be called
> through the pointer at some moment in time, but what the routine
> (whatever it is) is expected to do.
>
> (I know it's theoretical, but just introducing "hooks" (as function
> pointers are frequently called) can be a source of errors unless the
> semantics of such a hook are well defined).
>
> Now: Do you really want to know which specific routine is called, or do
> you want to know what the routine is supposed to do?
>
> [...]
>
> Regards,
> Ulrich

-- 
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To post to this group, send email to open-is...@googlegroups.com.
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/open-iscsi?hl=en.

Reply via email to