Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Extra libraries, Code snippets, applications etc. » C++ language problems and code snippets » explanation of c++ typedef line
Re: explanation of c++ typedef line [message #18236 is a reply to message #18235] Thu, 18 September 2008 15:23 Go to previous messageGo to previous message
captainc is currently offline  captainc
Messages: 278
Registered: December 2006
Location: New Jersey, USA
Experienced Member
This was one of the comments:
Quote:

typedef void* XYZHANDLE;
typedef void* IJKHANDLE;

is not type safe, since all handle will became mutually replaceable being all void*. (you can assign an XYZ to an IJK).

One way to get around this is to declare a category (empty struct) and point to it.

typedef struct XYZHANDLE_ {} *XYZHANDLE;
typedef struct IJKHANDLE_ {} *IJKHANDLE;


Now IJKHANDLE and XYZHANDLE cannot anymore be assigned each other.


Maybe the author replaced it incorrectly.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Time for little quiz!
Next Topic: Multiple statements in for loop
Goto Forum:
  


Current Time: Tue May 14 17:16:04 CEST 2024

Total time taken to generate the page: 0.01233 seconds