On 09/07/2020 11:44, Duncan Moore wrote:
First of all, many thanks to everyone who's contributed to the latest
release.

There are a couple of issues with isblank():

1) In <ctype.h>, isblank() is incorrectly defined the same as isspace():
 �� #� define isspace(c) (__ctype[(int) (c)] & ___ctype_white)
 �� #� define isblank(c) (__ctype[(int) (c)] & ___ctype_white)

2) When there's a function pointer to isblank(), I get a link failure:
"undefined reference to `isblank'".

So this program:

#include <stdio.h>
#include <ctype.h>
int main(void) {
 � int (*space)(int)=isspace;
 � int (*blank)(int)=isblank;������ // Fails to link.

 � printf("%i\n",!!isspace('\n'));
 � printf("%i\n",!!space('\n'));

 � printf("%i\n",!!isblank('\n'));
 � printf("%i\n",!!blank('\n'));��� // Fails to link.

 � return 0;
}

should give:

1
1
0
0

whereas, if the 2 lines with comments are removed, I get:

1
1
1

and it fails to link otherwise.

Ok, thanks for that, I can see that I failed to provide an isblank()
function to go with the macro.
Some googling shows that isblank() should return true only for a space
character or a tab. I could implement this easily in the function (and
remove the macro) by testing the characters directly, e.g.:

return (c == ' ' || c == '\t');

however, that doesn't go via the territory module like the other
ctype functions/macros do. On the other hand, the territory
module doesn't seem to distinguish this particular combination,
so I may have to cheat as above.
Does anyone know different or do I go with the cheat?

Thanks,
Lee.

_______________________________________________
GCCSDK mailing list gcc@gccsdk.riscos.info
Bugzilla: http://www.riscos.info/bugzilla/index.cgi
List Info: http://www.riscos.info/mailman/listinfo/gcc
Main Page: http://www.riscos.info/index.php/GCCSDK

Reply via email to