The following program allocates code space for the string, even though it's only used at compile time by sizeof().
int main() { return sizeof("hello"); } Here's the asm: ; ../strsiz.c:4: return sizeof("hello"); mov dptr,#0x0006 ; ../strsiz.c:5: } ret .area CSEG (CODE) .area CONST (CODE) .area CONST (CODE) __str_0: .ascii "hello" .db 0x00 I tested with sdcc 4.0.3 #11846 and #11771.
_______________________________________________ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user