FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Implied cast differs from explicit cast
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Implied cast differs from explicit cast [message #176660 is a reply to message #176659] Mon, 16 January 2012 03:39 Go to previous messageGo to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
On 1/15/2012 10:08 PM, lb wrote:
> jstucklex(at)attglobal(dot)net wrote:
>> ...
>> No, it is not. '0x12' is a hex number, not an integer. (int)'0x12'
>> converts this correctly to 0.
>
> OK, but if (int)'0x12' is 0, why is '0x12'+0 == 18?
>
> Why are they different? Aren't they both doing 'string conversion to number'?

As I said - '0x12' is a hex value, not an integer. You are trying to
convert it as if it were a string representation of an integer. The
implicit conversion recognizes it is a hex value and uses the
appropriate conversion.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Open Source Development
Next Topic: error from phpadmin
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Sep 20 14:33:04 GMT 2024

Total time taken to generate the page: 0.04982 seconds