f



Compilation Issue.

Hi,

   I am writing code for an Atmega645. I use the IAR compiler (v4.2).
I noticed that this piece of the code was not working. Meaning even if
the if condition evaluated to 0, it did not enter the loop. I am not
sure if I cleaned up all the project files before issuing a build (but
I think I did). But I know I issued a build several time and observed
this problem at all times.


{
  if ( !GetMessageCount() )
      {
   ..........do something....

    return;
     }

  ....do something else....
  return.
}

However, when I changed it to this, it worked.

{
 if ( GetMessageCount() == 0)
      {
   ..........do something....

    return;
     }

  ....do something else....
  return.
}

Further,  when I changed it back again, it worked properly !!!

 How can you explain that?

Btw, GetMessageCount is defined below.
unsigned char GetMessageCount()
{
   return MessageCount;
}

0
8/7/2007 6:58:30 AM
comp.lang.c 30657 articles. 4 followers. spinoza1111 (3246) is leader. Post Follow

3 Replies
433 Views

Similar Articles

[PageSpeed] 20

karthik.naig@gmail.com wrote:
> 
> Further,  when I changed it back again, it worked properly !!!
> 
It looks like you have an issue with your build process, rather than with C.

-- 
Ian Collins.
0
ian-news (10155)
8/7/2007 7:01:45 AM
On Aug 7, 12:01 pm, Ian Collins <ian-n...@hotmail.com> wrote:
> karthik.n...@gmail.com wrote:
>
> > Further,  when I changed it back again, it worked properly !!!
>
> It looks like you have an issue with your build process, rather than with C.
>
> --
> Ian Collins.

Can you elaborate? What might be going wrong?

0
8/8/2007 9:42:13 AM
karthik.naig@gmail.com <karthik.naig@gmail.com> wrote:
> On Aug 7, 12:01 pm, Ian Collins <ian-n...@hotmail.com> wrote:
> > karthik.n...@gmail.com wrote:
> >
> > > Further,  when I changed it back again, it worked properly !!!
> >
> > It looks like you have an issue with your build process, rather than with C.
> >
> > --
> > Ian Collins.
> 
> Can you elaborate? What might be going wrong?

Anything, as long as you don't tell what do you do to build.

M.
0
wolcendo (28)
8/10/2007 2:00:45 PM
Reply: