IP ADDRESS OF MACHINE

Nelson Guedes Paulo Junior npaulo@linux.ime.usp.br
Thu Feb 28 10:15:00 GMT 2002


Hi Eljay,

Thanks for helping, but did you, or others now how the program could work
without this patch on fwyzard's machine like her described?

If you put a cast to (unsigned char) in fornt of some (*entry)[0] you get
the correct results too, but why in her's machine this works whitout any
patch? Is this a portable solution?

Thanks.



-----
Nelson Guedes Paulo Junior   
E-mail:  <npaulo@linux.ime.usp.br>   UIN: 2489382 (Tender [:alpha:]*)
"LAPTOPirose é a doença causada pela urina do mouse"

On Thu, 28 Feb 2002, John Love-Jensen wrote:

> Hi Nelson,
> 
> Change the one line to...
>     typedef unsigned char byte;
>      printf ("address:    %hhu.%hhu.%hhu.%hhu\n", \
>        (*entry)[0] & 0xFF,
>        (*entry)[1] & 0xFF,
>        (*entry)[2] & 0xFF,
>        (*entry)[3] & 0xFF);
> 
> What you are seeing is an octet being treated as signed, and the signed
> extension value being displayed as an unsigned int.
> 
> The mask will slice the sign extended high-bits off properly.
> 
> --Eljay
> 
> 
> 





More information about the Gcc-help mailing list