This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Compile char as an unsigned char

Hello,

Can anyone tell me how to instruct Keil to compile char's as unsigned char's by default?

I know that there are some help topics on this issue, but they seem to be giving a precompiler directive to tell the compiler to always compile char's as signed char's....

Thanks!
Eric

Parents
  • do chose char to have the same range as unsigned char, but still they are not the same type.

    This is pure language and the following is not 'you are wrong' just another (I think equally valid) interpretation of the language

    "do chose char to have the same range as unsigned char, which makes them the same"

    Erik

Reply
  • do chose char to have the same range as unsigned char, but still they are not the same type.

    This is pure language and the following is not 'you are wrong' just another (I think equally valid) interpretation of the language

    "do chose char to have the same range as unsigned char, which makes them the same"

    Erik

Children
  • No.

    The char type is NEVER the same type as unsigned char or signed char.

    They are 3 different types. They are not the same

    char is defined to have the same range as signed char or unsigned char, but not to be the same type as.

    The problem (Eric with a C) had was that the types unsigned char and char where mixed and the compiler was giving warnings (because they are not the same type).

    Becuase we set the default to interrpret char as having the same range as unsigned char, we could ignore the warnings.

  • Let me see if I understand you.

    This particular compiler treat unsigned char and char the same way, but because someone may assume that it is done the other way the compiler complain when you mix the two.

    Thus, if your 'understanding' of (un)signed char and char is the same as the compiler it is safe to ignore the warning. (I disagree here: I would never consider it safe to ignore a warning - but that is a different story)

    am I right?

    When accused of being ignorant rather than getting a simple statement (maybe with a reference), I have no reason to put any credence to the response from the accuser.
    Robert, since you gave me a 'sane' explanation, I will admit that my 'knowledge' based on a statement in (was it) '87 by the instructor of the C class I then took: "char and signed char is the same" may have changed since then/been wrong. He actually added "to be clear always state (un)signed char, never just char". I have NEVER used just 'char' (I like to be specific as well) thus there has never been a reason to believe that statement from '87 and Kochans seeming agreement with it was incorrect.

    I wonder if Jack Sprat peruses several books to verify his knowledge before posting, I doubt it, so it is very possible that at some time it will be him that is "the grossly opinionated that show his ignorance with such panache"

  • Let me see if I understand you.

    This particular compiler treat unsigned char and char the same way, but because someone may assume that it is done the other way the compiler complain when you mix the two.

    Thus, if your 'understanding' of (un)signed char and char is the same as the compiler it is safe to ignore the warning. (I disagree here: I would never consider it safe to ignore a warning - but that is a different story)

    am I right?

    When accused of being ignorant rather than getting a simple statement (maybe with a reference), I have no reason to put any credence to the response from the accuser.
    Robert, since you gave me a 'sane' explanation, I will admit that my 'knowledge' based on a statement in (was it) '87 by the instructor of the C class I then took: "char and signed char is the same" may have changed since then/been wrong. He actually added "to be clear always state (un)signed char, never just char". I have NEVER used just 'char' (I like to be specific as well) thus there has never been a reason to believe that statement from '87 and Kochans seeming agreement with it was incorrect.

    I wonder if Jack Sprat peruses several books to verify his knowledge before posting, I doubt it, so it is very possible that at some time it will be him that is "the grossly opinionated that show his ignorance with such panache"

  • TYPO, TYPO, TYPO

    the line in the post above:
    specific as well) thus there has never been a reason to believe that

    should read

    specific as well) thus there has never been a reason not to believe that

    and that after a preview :(

    Erik

  • When accused of being ignorant rather than getting a simple statement (maybe with a reference), I have no reason to put any credence to the response from the accuser.

    The expectation is that you would have the wit to actually consult the document you claim to be quoting. You rarely hesitate to lambast others for failing to Please read the manual.

    I will admit that my 'knowledge' based on a statement in (was it) '87 by the instructor of the C class I then took:

    Now you're blaming a 'C' class you took 19 years ago?

    I wonder if Jack Sprat peruses several books to verify his knowledge before posting

    No, I just consult the 'C' standard. That way I get the right information first time.

    so it is very possible that at some time it will be him that is "the grossly opinionated that show his ignorance with such panache"

    Dream on.

  • Dream on.

    I expressed a possibility, not a desire.

    Erik

  • I expressed a possibility, not a desire.

    Perhaps you should buy a dictionary at the same time as a copy of the 'C' standard:

    dream on

    Informal

    Used in the imperative to indicate that a statement or suggestion is improbable or unrealistic.

    dictionary.reference.com/search