[CWB] Strange behavior of isupper() (in ctype.h)

Sylvain Loiseau sylvain.loiseau at wanadoo.fr
Mon Oct 8 13:10:01 CEST 2012


Dear all,

It seems that isupper() in CWB behave strangely in the context of the R wrapper rcqp.

On a linux (ubuntu and debian) system, the code :
     printf(%d\n", isupper('A'));
outputs :
    0
when compiled with the R framework (of course it behaves correctly when compiled as a standalone program).

On mac osx, the code produce the expected output.

This unexpected output is observed only in the context of CWB compiled through rcqp, only on linux (not mac osx), and only under certains circumstances, since a minimal R package produce the expected output. Even in CWB, this strange behavior is not observed in any part of the code -- but it is in cl/attributes.c

A work-around is to remove the first declaration in cl/attributes.c :
    #include <ctype.h>
where, however, the isupper function is supposedly declared.

Since the program is compiled and run correctly without this declaration, isupper is also declared elsewhere, and the problem may be due to complex interaction between the R header (?) and the cl/attributes.cl include…

Any hint?
Best,
Sylvain


More information about the CWB mailing list