Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Codewarrior Embedded > Re: HCS12 Compi...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 4 Topic 366 of 416
Post > Topic >>

Re: HCS12 Compiler warning

by "Gary Schnabl" <LivernoisYards@[EMAIL PROTECTED] > Dec 16, 2005 at 02:58 PM

"msolem" <msolem@[EMAIL PROTECTED]
> wrote in message 
news:1134752029.820021.269860@[EMAIL PROTECTED]
> Ok, that makes sense, thanks.  The warning does disappear if I do this:
> var = (char)(var / 2);
>
> But if it's the constant 2 that's causing the promotion, shouldn't this
> also compile warning free (which it doesn't):
> var = var / (char)2
>
> I see that the HCS12 has no 8 bit divide assembly instruction.  So in
> some
> sense I guess it gets promoted to 16 bit no matter what.  Is that why
> that line still produces the warning?
>
> Mike

Try changing the 2 to a char differently:
char var;
const char TWO = 2;
....
var = var/TWO;

There should be no promotion/demotion doing it that way, as both are
chars. 
If you read the manual, you would know that you could change the warning
to 
a different type of message, such as "information".

I could try it myself, but you could do it before I get to it. I'll try it

later and see, though.
 




 4 Posts in Topic:
HCS12 Compiler warning
"msolem" <ms  2005-12-15 14:54:09 
Re: HCS12 Compiler warning
"Gary Schnabl"   2005-12-16 09:12:15 
Re: HCS12 Compiler warning
"msolem" <ms  2005-12-16 08:53:49 
Re: HCS12 Compiler warning
"Gary Schnabl"   2005-12-16 14:58:32 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Oct 15 19:39:29 CDT 2008.