Type Comparison

Just starting out? Need help? Post your questions and find answers here.
Lazarus404
User
User
Posts: 74
Joined: Fri Dec 02, 2005 3:11 pm
Location: England
Contact:

Type Comparison

Post by Lazarus404 »

Hey guys,

Okay, I'm finding it hard to locate an operator or function to use to compare types. I have a function that can acquire any type that extends a structure I've defined, but it's also possible that this function may acquire a type it isn't set to deal with, as the values are passed from a C dll. How do I compare types to check they are compatible, before extracting data?

Thanks,
Laz

Registered PureBasic user since Nov 2005
Check out FlashML at www.designrealm.co.uk... The ultimate Flash Component
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

You can't do this. You must simply avoid passing in invalid data.
User avatar
tinman
PureBasic Expert
PureBasic Expert
Posts: 1102
Joined: Sat Apr 26, 2003 4:56 pm
Location: Level 5 of Robot Hell
Contact:

Post by tinman »

If you have control of the base structure you could add a known identifier (either value or string) to the structure and make sure this matches with one you know how to handle.

Of course, that assumes the C DLL author won't be nasty enough to simply find out what the ID value is and copy it before stuffing it into their structure.

Got any more info on what you're trying to do?
If you paint your butt blue and glue the hole shut you just themed your ass but lost the functionality.
(WinXPhSP3 PB5.20b14)
Post Reply