tekknolagi/carp

Compilation issue in Cygwin

Closed this issue · 5 comments

Just wanted to let you know of an issue present when I try to build this on Cygwin 64 bit
I run "make" and I get this output:

cc -c -g3 -std=c99 -Wall -Werror -Wno-unused-variable -Wno-format-security src/ carp_registers.c src/carp_instructions.c src/carp_lexer.c src/carp_machine.c src /carp_tokenizer.c src/lib/carp_stack.c src/lib/carp_ht.c
src/carp_tokenizer.c: In function ‘is_num’:
src/carp_tokenizer.c:159:3: error: array subscript has type ‘char’ [-Werror=char -subscripts]
if (!(is_sign(s[0]) || isdigit(s[0]))) return 0;
^
src/carp_tokenizer.c:162:5: error: array subscript has type ‘char’ [-Werror=char -subscripts]
if (!isdigit(s[i])) return 0;
^
cc1: all warnings being treated as errors
Makefile:17: recipe for target 'build' failed
make: *** [build] Error 1

Can you paste the version of your compiler?

On Fri, Aug 29, 2014 at 9:48 PM, arthurcolle notifications@github.com
wrote:

Just wanted to let you know of an issue present when I try to build this
on Cygwin 64 bit
I run "make" and I get this output:

cc -c -g3 -std=c99 -Wall -Werror -Wno-unused-variable -Wno-format-security
src/ carp_registers.c src/carp_instructions.c src/carp_lexer.c
src/carp_machine.c src /carp_tokenizer.c src/lib/carp_stack.c
src/lib/carp_ht.c
src/carp_tokenizer.c: In function ‘is_num’:
src/carp_tokenizer.c:159:3: error: array subscript has type ‘char’
[-Werror=char -subscripts]
if (!(is_sign(s[0]) || isdigit(s[0]))) return 0;
^
src/carp_tokenizer.c:162:5: error: array subscript has type ‘char’
[-Werror=char -subscripts]
if (!isdigit(s[i])) return 0;
^
cc1: all warnings being treated as errors
Makefile:17: recipe for target 'build' failed
make: *** [build] Error 1


Reply to this email directly or view it on GitHub
#24.

@tekknolagi isdigit takes an int as an input not a char, and looks like a platform-dependent issue.
Here is a good explanation: http://stackoverflow.com/questions/10186219/array-subscript-has-type-char

So what would you advise? Also, @akkartik any input?

Khaled's stackoverflow link recommends a type cast.

Whoops, totally missed that somehow. Anyway, how does the cast on master
work?

On Sat, Sep 6, 2014 at 5:53 PM, Kartik Agaram notifications@github.com
wrote:

Khaled's stackoverflow link recommends a type cast.


Reply to this email directly or view it on GitHub
#24 (comment).