ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 16th, 2005, 03:31 PM
timster121 timster121 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 83 timster121 User rank is Corporal (100 - 500 Reputation Level)timster121 User rank is Corporal (100 - 500 Reputation Level)timster121 User rank is Corporal (100 - 500 Reputation Level)timster121 User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 3 Days 13 h 48 m 14 sec
Reputation Power: 6
Strange problem with datatypes?

Sorry if the title is a bit vague. Don't know how else to describe this. For reference, this is CF5.

To make a long story short, this bit of code actually outputs "true".

Code:
<cfif "00D96" EQ "00D40">
true
<cfelse>
false
</cfif>


On further investigation, it appears that "00D<number>" will equal any other "00D<number>"

I've searched but nothing has come up.

What's going on here? Is ColdFusion getting its datatypes confused? Does CF have typecasting?

Reply With Quote
  #2  
Old August 16th, 2005, 04:58 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,689 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 16 h 33 m 51 sec
Reputation Power: 53
It could easily be some kind of type casting error in CF 5. That version is something like five years old. The code runs correctly on CFMX 6, 6.1, and 7.0.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
  #3  
Old August 16th, 2005, 08:10 PM
timster121 timster121 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 83 timster121 User rank is Corporal (100 - 500 Reputation Level)timster121 User rank is Corporal (100 - 500 Reputation Level)timster121 User rank is Corporal (100 - 500 Reputation Level)timster121 User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 3 Days 13 h 48 m 14 sec
Reputation Power: 6
Yeah. I had a friend test it on 6.1 as well.

Unfortunatly, I don't have a choice as to which version I'm using.

You're probably right that it's a type casting issue. Cursed CF for being a loosely typed language.

edit: It works properly when I use the compare() function. Looks like that's my solution.

Reply With Quote
  #4  
Old August 16th, 2005, 08:58 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,689 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 16 h 33 m 51 sec
Reputation Power: 53
CF's loose typing is actually a huge speed booster in most cases. And again, the problem doesn't affect any recent version. The type casting has improved greatly since the switch to Java.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Strange problem with datatypes?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT