I am currently looking into the source of Sean Barrett's STB library, and while I think I generally understand what is going on, I have some questions about some of the decisions.
Below, you can find a link to Pastebin with the relevant "stb.h" Quick Sort code.
I have a few questions:
1. on lines 69 and 70, Sean writes:
/* handling of equality is crucial here */
/* for sentinels & efficiency with duplicates */
I don't really get what the comments on 69 and 70 are saying; what does Sean mean by handling of equality and sentinels? in what sense is this important for efficiency with duplicates? is he talking about the user supplied comparison function? i don't really get what he's saying here.
2. why does Sean use pointers for variables a & b. for example, he does
TYPE *a,*b, t;
a = &p[m];
b = &p[n-1];
instead of just a = p[m] and b = p[n - 1] with TYPE a, b. I don't see any reason for having an extra level of indirection with the pointer.
hopefully, i explained my questions well; I'm not very good at English, so if more clarification is needed I can certainly do that.