TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: NEIL HELLER
from: DARIN MCBRIDE
date: 1998-01-20 08:54:00
subject: WARNING MESSAGE - 2

 NH> Given the following code:
 NH> void
 NH> foo(void)
 NH> {
 NH>      unsigned char foo = 'z';
 NH>      foo = foo >> 3;     /* warning on this line */
 NH> }
 NH> The warning I receive is that the line of code above involves
 NH> "conversion between integral types".  However, if I write the
 NH> offending line as:
 NH>      foo = (unsigned char)(foo >> 3);
 NH> I don't receive the warning messages.  Why is this?
Because you are now EXPLICITLY converting between unsigned int and unsigned 
char (a lossy conversion).
The >> and << operators work on ints, not chars.
---
---------------
* Origin: Tanktalus' Tower BBS (1:250/102)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.