David VanHorn wrote:
        I know what *I* am missing - the source code!  How is anyone
        supposed to help you with your problem until you post the actual
        compilable code snippet?  We need a compilable code sample which
        demonstrates the problem, along with the compiler flags you used
        and also the compiler version you used.  Getting a warning for
        int8_t but not for "signed char" is not expected behaviour, and
        I think many people (as well as you) would be interested to find
        out if that is really the case, and if so, if there is some
        strange compiler issue.  But we need the code so that other
        people can test this.

Fine.. I thought I must be doing something fairly trivial wrong, this IS only my second project in C... I expected to be told that I was using lcd_puts wrong, or declaring something improperly, or some other noob mistake.
What I'm seeing is certainly unexpected to ME.
I'm very reluctant to throw out bunches of code, when the problem is likely to be some trivial thing that "everyone knows".

I used to have a colleague who had a large piece of foam rubber taped to his wall - it was labelled "bang your head here". Sometimes I think I need to get one of these myself.

The code you posted is *not* a code snippet that others can compile and test. It doesn't even use lcd_puts !!

Post a *minimal* code snippet that can be compiled. There should be an absolute minimum of #include lines, and never any #include's that don't come as part of a standard avr-gcc installation. Putting #include "lcd.h" is totally, utterly useless - how are we supposed to guess what's in lcd.h ?? Perhaps it contains the declaration for lcd_puts() - the function you are needing help with?


An example code snippet is shown below.

With the flag -funsigned-char and appropriate warnings enabled, this gives - as expected - a warning "pointer targets in passing argument 1 of 'lcd_puts' differ in signedness" for lcd_test2, 3, and 4. Using uint8_t gives no warning, because it is the same as "signed char".

I conclude from this that there is nothing wrong with the compiler or its error checking here - the warnings are exactly as expected. However, there might be something else wrong with your code - no one will ever know until you post the *relevant* code.


mvh.,

David



#include <stdint.h>

extern void lcd_puts(signed char *p);

extern void lcd_test1(void);    // To avoid "missing-prototype" errors
void lcd_test1(void) {
        signed char a[] = "a";
        lcd_puts(a);
}

extern void lcd_test2(void);
void lcd_test2(void) {
        unsigned char a[] = "a";
        lcd_puts(a);
}

extern void lcd_test3(void);
void lcd_test3(void) {
        char a[] = "a";
        lcd_puts(a);
}

extern void lcd_test4(void);
void lcd_test4(void) {
        uint8_t a[] = "a";
        lcd_puts(a);
}

extern void lcd_test5(void);
void lcd_test5(void) {
        int8_t a[] = "a";
        lcd_puts(a);
}



_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to