C or lite-c issue?

Posted By: Mishiwaka

C or lite-c issue? - 06/13/23 17:41

Hi everyone, I have an issue with a code that always returns a syntax error, but this time I can figure out what is really wrong ((( any help?
The error comes from line
double x = *(const double *)a;
and will definitely will pop up also from the next one

int compare(const void *a, const void *b)
{
double x = *(const double *)a;
double y = *(const double *)b;
if (x < y)
{
return -1;
}
else if (x > y)
{
return 1;
}
return 0;
}
Posted By: AndrewAMD

Re: C or lite-c issue? - 06/14/23 13:14

Lite-C has some eccentricities. The compiler probably does not understand your casts.

Just make pointers to double and dereference them in your comparisons.
Posted By: jcl

Re: C or lite-c issue? - 06/15/23 13:34

Lite-C knows double, but not const.
© 2024 lite-C Forums