about typeof

Does WDM OR WDF offers a keyword which has the same function as “typeof”?

thanks

This is a part of the C++ language and not WDM or WDF.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

wrote in message news:xxxxx@ntdev…
> Does WDM OR WDF offers a keyword which has the same function as “typeof”?
>
> thanks
>

Do you mean support for runtime type identification? Nope, there is no support for it

d

tiny phone keyboard + fat thumbs = you do the muth

-----Original Message-----
From: xxxxx@hotmail.com
Sent: Tuesday, February 02, 2010 5:53 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] about typeof

Does WDM OR WDF offers a keyword which has the same function as “typeof”?

thanks


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

thanks everyone.

yeah, It seams that I must use other way to realize the similar function.

Do you mean support for runtime type identification? Nope, there is no support
for it

> This is a part of the C++ language…

I think you are confusing it with typeid operator, which is, indeed, C++ -only feature that is closely
related to RTTI. However, IIRC, typeof is just a compiler-specific nonstandard extension that is used by some compliers (for example, GCC), which is meant to work at the compile time for both C and C++ and has nothing to do with run-time information .For example, look at how container_of macro can be defined using typeof:

#define container_of(ptr, type, member) ({ \
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
(type *)( (char *)__mptr - offsetof(type,member) );})

Anton Bassov

What are you trying to do? What are you doing that needs rtti?

d

tiny phone keyboard + fat thumbs = you do the muth

-----Original Message-----
From: xxxxx@hotmail.com
Sent: Tuesday, February 02, 2010 6:45 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] about typeof

thanks everyone.

yeah, It seams that I must use other way to realize the similar function.

>Do you mean support for runtime type identification? Nope, there is no support
>for it


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

yeah, you are right and I am confusing.

I just want to porting some Linux code to my WDF driver.
The Linux code uses “typeof” and I have to modify it.

> This is a part of the C++ language…

I think you are confusing it with typeid operator, which is, indeed, C++ -only
feature that is closely
related to RTTI. However, IIRC, typeof is just a compiler-specific nonstandard
extension that is used by some compliers (for example, GCC), which is meant to
work at the compile time for both C and C++ and has nothing to do with run-time
information .For example, look at how container_of macro can be defined using
typeof:

#define container_of(ptr, type, member) ({ \
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
(type *)( (char *)__mptr - offsetof(type,member) );})

Anton Bassov

Porting Linux code to my WDF driver.

What are you trying to do? What are you doing that needs rtti?

> I just want to porting some Linux code to my WDF driver.

For the practical purposes it is impossible to port Linux code to Windows - you need a complete rewrite, because Linux and Windows architectures are much too different from one another to allow even imprecise mapping between these two…

Anton Bassov

d

tiny phone keyboard + fat thumbs = you do the muth

-----Original Message-----
From: xxxxx@hotmail.com
Sent: Tuesday, February 02, 2010 7:46 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] about typeof

> I just want to porting some Linux code to my WDF driver.

For the practical purposes it is impossible to port Linux code to Windows - you need a complete rewrite, because Linux and Windows architectures are much too different from one another to allow even imprecise mapping between these two…

Anton Bassov


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

thanks!

For the practical purposes it is impossible to port Linux code to Windows - you
need a complete rewrite, because Linux and Windows architectures are much too
different from one another to allow even imprecise mapping between these
two…

wrote in message news:xxxxx@ntdev…
> Does WDM OR WDF offers a keyword which has the same function as “typeof”?

No, typeof is GNU C extension, the MS compiler does not have it
(and most of other GNU extensions that you can find in Linux code).

Good luck,
–pa

>No, typeof is GNU C extension, the MS compiler does not have it

(and most of other GNU extensions that you can find in Linux code).

thanks !