Skip to main content
mjobard2
Associate
Dec 21, 2010 3:05 PM UTC
Question

Compiling problem with Cosmic CxSTM8 16K and LONG data

Posted on December 21, 2010 at 16:05

Compiling problem with Cosmic CxSTM8 16K and LONG data

    This topic has been closed for replies.

    4 replies

    mjobard2
    mjobard2Author
    Associate
    May 17, 2011 1:11 PM UTC
    Posted on May 17, 2011 at 15:11

    Works fine now... thanks for the reminder (but where is my Bible-C?!).

    'Thought that the compiler would warn that signed data was compared with unsigned variables, but I guess you can not expect too much from a free compiler.

    Andrew Neil
    Super User
    May 17, 2011 1:11 PM UTC
    Posted on May 17, 2011 at 15:11

    The compiler is behaving perfectly correctly!

    ISO/IEC 9899:1990 - the so-called ''ANSI C'' specification - states:

    ''The type of an integer constant is the first of the corresponding list in which its value can be represented. Unsuffixed decimal: int, long int, unsigned long int...''

     

    If you want to force the type of the constant to be unsigned, then you need to add the suffix 'u' or 'U'...

    A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
    Andrew Neil
    Super User
    May 17, 2011 1:11 PM UTC
    Posted on May 17, 2011 at 15:11

    ''Thought that the compiler would warn that signed data was compared with unsigned variables''

    Other than special cases, what's to warn about?

    What warning would you suggest?

    A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
    luca239955_stm1_st
    Associate
    May 17, 2011 1:11 PM UTC
    Posted on May 17, 2011 at 15:11

    >> 'Thought that the compiler would warn that signed data was compared with unsigned variables, but I guess you can not expect too much from a free compiler.

    can you provide an example of a compiler raising a warning for this?

    Regards,

    Luca