From: SourceForge.net <no...@so...> - 2004-08-02 16:01:49
|
Bugs item #972628, was opened at 2004-06-14 18:08 Message generated for change (Comment added) made by maartenbrock You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=972628&group_id=599 Category: None >Group: non bugs >Status: Closed >Resolution: Rejected Priority: 5 Submitted By: Nobody/Anonymous (nobody) >Assigned to: Maarten Brock (maartenbrock) Summary: pointer types incompatible? Initial Comment: SDCC produces the following error, when I compile the attached file: Untitled.c:6: error: pointer types incompatible I tried with the latest version: sdcc -v SDCC : mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51 /ds400/hc08 2.4.2 (J un 13 2004) (MINGW32) I simply could not figure out the right solution so that every string is stored in code memory and every pointer is code pointer. I think I have tried every combination. The goal of the code would be to store "arr0" and "arr1" strings only once and refer to them in cc[] as initializer. Could you please check if it is really a bug or there is a solution that I have missed? Related to this issue I would like to ask if there is a "merge duplicate strings" feature in the compiler? (The aim of this feature is to store constant strings that are exactly the same only once in code memory.) By observing the complied assembly file I can see that some strings are stored only once, but mostly stored as many times they are initialised. Regards, Laszlo BORTEL bor...@ln... ---------------------------------------------------------------------- >Comment By: Maarten Brock (maartenbrock) Date: 2004-08-02 18:01 Message: Logged In: YES user_id=888171 I'm afraid this is no bug. This code looks like: const char b = 1; char c = b; void main(void) {} Allthough it should be possible to parse this, this is not in the standard and there is no compiler I know of that implements this. Maybe the best solution would be something like: const char b0[] = "arr0"; const char b1[] = "arr1"; const struct c { const char* d[2]; } cc[2] = { {{"0a", "0b"}}, {{b0, b1}} }; Closing this now. Maarten ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2004-06-15 10:37 Message: Logged In: NO Sorry, the missing code is: code char* b[2]={"arr0", "arr1"}; code struct c { code char* d[2]; } cc[3] = { {{"0a", "0b"}}, {{b[0], b[1]}}, {{"1a", "1b"}} }; void main (void) {} ---------------------------------------------------------------------- Comment By: Maarten Brock (maartenbrock) Date: 2004-06-14 21:05 Message: Logged In: YES user_id=888171 Laszlo, There's no file attached. Please try again or this bug will have to be closed as non-reproducable. Greets, Maarten ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=972628&group_id=599 |