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

clojure: use singed char for c string for suppressing warning in compila... #243

Merged
merged 1 commit into from
Feb 26, 2015

Conversation

masatake
Copy link
Member

...tion

People who know well about standard C library, is this correct fix?
Should I make fileReadLine return char * value instead?

…ilation

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
@masatake
Copy link
Member Author

@b4n, could you look at this?

@b4n
Copy link
Member

b4n commented Feb 25, 2015

LGTM.

char vs. unsigned char is a bit subtle, especially because an implementation is actually allowed to have char itself as unsigned. Anyway, most API taking a string expect a pointer to char, not unsigned char. OTOH, most API taking single characters expect an int with the value of an unsigned char.

In theory, unsigned char makes more sense so you get meaningful values for bytes > 0x7f (e.g. above ASCII) -- having e.g. byte 0xff as 255 looks more sensible than getting -1.
But in practice it doesn't matter so much, because not only as we see most APIs take chars, and APIs that take ints properly handle the conversion anyway, but also we generally don't deal with non-ASCII characters directly anyway.

So I guess that when we want to use string.h API it makes more sense to use char.

masatake added a commit that referenced this pull request Feb 26, 2015
clojure: use singed char for c string for suppressing warning in compila...
@masatake masatake merged commit be5628f into universal-ctags:master Feb 26, 2015
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

Successfully merging this pull request may close these issues.

2 participants