From: Ullrich von Bassewitz (uz_at_musoftware.de)
Date: 2003-09-03 10:44:57
On Wed, Sep 03, 2003 at 08:33:40AM +0200, Groepaz wrote: > mmmh...could you explain how exactly cc65 deals with the const keyword then? > does it do anything else than placing const data in .rodata? > > also, maybe the compiler could throw a warning if an assignment is made to a > constant lvalue (which doesnt quite make sence :=)) ? gcc warns on assignment to const, while cc65 does even output an error, so I do still wonder, about which cases you're thinking: ----------------------------------------------------------------------------- uz_at_trixie:~/src/cc65/test$ cat test.c int main (void) { const char* a = "Hello world!\n"; *a = 'F'; } uz_at_trixie:~/src/cc65/test$ make ../src/cc65/cc65 -g -T -Oirs --codesize 400 --create-dep -t c64 -I../include/ test.c test.c(4): Error: Assignment to const make: *** [test.o] Error 1 uz_at_trixie:~/src/cc65/test$ gcc -Wall -o test -O2 test.c test.c: In function `main': test.c:4: warning: assignment of read-only location test.c:5: warning: control reaches end of non-void function uz_at_trixie:~/src/cc65/test$ ----------------------------------------------------------------------------- Regards Uz -- Ullrich von Bassewitz uz_at_musoftware.de ---------------------------------------------------------------------- To unsubscribe from the list send mail to majordomo_at_musoftware.de with the string "unsubscribe cc65" in the body(!) of the mail.
This archive was generated by hypermail 2.1.3 : 2003-09-03 10:45:16 CEST