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

error messages versus opt level

I have noticed that I get error messages or I don't sometimes depending on optimization level. For example, I had a statement that tried to store a value into code space and at opt level zero, I got an error saying that it couldn't convert the lvalue. I understood this. However, at opt level 8, I got no error and in fact the 'optimizer' simply left out the offending line. Why should it do this? If it is an error, it should report it and not throw the code away.

Parents
  • #define BYTE int

    Just a note, the above is quite disgusting and misleading. This is exactly what typedef's are for and int's on many platforms are more than a BYTE (PIC excepted). What is wrong with
    typedef int TwoBytes;
    If you need to see if the typedef is "defined" you can still simply define something like:

    typedef int TwoBytes;
    #define TWO_BYTE_TYPE
    I know I should just keep my mouth shut, I'm sorry for butting in but this mis-use of a #define made me spill my beer - another crime.

    - Mark

Reply
  • #define BYTE int

    Just a note, the above is quite disgusting and misleading. This is exactly what typedef's are for and int's on many platforms are more than a BYTE (PIC excepted). What is wrong with
    typedef int TwoBytes;
    If you need to see if the typedef is "defined" you can still simply define something like:

    typedef int TwoBytes;
    #define TWO_BYTE_TYPE
    I know I should just keep my mouth shut, I'm sorry for butting in but this mis-use of a #define made me spill my beer - another crime.

    - Mark

Children