Mhh, no, I don't see how macros could help. I mean, if I define a macro like
Code:
#define someMacro(this, argument1, argument2)


it would still look like a function call. Or am I missing something?

About the compiling problem; Yep, I probably forgot to define the target environment as Lite-C before uploading the version, you can change this in the LFBase.h file.


Anyway, a new version is out and I would recommend the update. First of all: It fixes two bugs with the string comparison:
1) LFStringCompare() searched only the whole string -1 character
2) The functions would compare a lowercase letter greater than a uppercase letter. This means that "BBBBB" compared to "aaaaa" would be smaller, while "aaaaa" should actually smaller than "BBBBBB".

The next thing is also about string comparison: Numerical comparison. This means that "Charles 1" is smaller than "Charles 2" and greater than "Charles 0". This only works with unsigned integers but its pretty neat.

Another thing is for comparison in general: The LFComparisonResult type could not hold kLFCompareLessThan because Lite-C doesn't respect "signed char".

The really big new thing: Arrays can be sorted.
Okay, array sorting is not that fancy, everyone can write a simple bubble sort. But because bubble sort is the most slowest sorting algorithm on earth, I decided to take some time and implement a sorting algorithm that sorts the array in O(N log N) worst case and normally in O(log N).
The used algorithm is a introsearch algorithm, the function will first try to sort the array with quicksort and if it ends in a degenerate case (it checks the recursion depth), the function will switch to heapsort which is guaranteed to sort the array in O(N log N). Actually its pretty hard to end in the heapsort, in 99,9999% of all cases the quicksort algorithm will do its job.
However, as recursion is expensive, the quicksort implementation will not sort the whole array but only up to a certain threshold (which is subarrays must be larger than 10).
The rest is done via an insertion sort which is way faster for almost sorted arrays than quicksort.

I have updated the Arrays.c example to show how easy it is to sort an array with 63 strings in it (populating the array takes way more space in the demo).
As always, the old links still work. And: I would love to hear your feedback laugh


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com