Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler complaints about char vs unsigned char #109

Open
jonsmirl opened this issue Mar 31, 2023 · 0 comments
Open

Compiler complaints about char vs unsigned char #109

jonsmirl opened this issue Mar 31, 2023 · 0 comments

Comments

@jonsmirl
Copy link

jonsmirl commented Mar 31, 2023

I had to change this, because isdigit() is internally implemented with an array on my system and the compiler just refused to allow a possible negative index into the array. gcc 12.2.0

jonsmirl@ares:~/lowpan/components/forth$ git diff floatops.c
diff --git a/components/forth/floatops.c b/components/forth/floatops.c
index 3276f69..d3db981 100755
--- a/components/forth/floatops.c
+++ b/components/forth/floatops.c
@@ -11,7 +11,7 @@
 #include <stdlib.h>
 #include <ctype.h>
 
-char *ecvt(double n, int ndigits, int *decpt, int *sign);
+unsigned char *ecvt(double n, int ndigits, int *decpt, int *sign);
 char *fcvt(double n, int ndigits, int *decpt, int *sign);
 
 #ifdef NeXT
@@ -233,7 +233,7 @@ fintop(int op, cell *sp, cell *up)
                } else {
                        int decpt, sign;
                        int places = (int)V(FNUMPLACES);
-                       char *digits = ecvt(ftos, places+1, &decpt, &sign);
+                       unsigned char *digits = ecvt(ftos, places+1, &decpt, &sign);
                        char *s = floatstr;
                        if (sign)
                                *s++ = '-';
@@ -310,7 +310,7 @@ fintop(int op, cell *sp, cell *up)
                {
                    int len = *sp++;
                    char *adr = (char *)(*sp++);
-                   char *radr;
+                   unsigned char *radr;
                    int decpt, sign;
 
                    radr = ecvt(ftos, len, &decpt, &sign);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant