Re: [NtDev] Re: Silly question on IA64

> Perhaps I’m letting my bias show here, but I can’t imagine using MS

code as a model of good programming style

Why not? Linux is even worser (while FreeBSD is better).

Max


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Ack! You’re right. I should have checked. So I have to, in effect,
employ ULONG after all.


James Antognini
IBM Watson Research


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Nope PVOID cannot have arithmetic operations because
as you point out sizeof(void) is not valid.

Don Burn
Windows 2000 Device Driver and Filesystem consulting

----- Original Message -----
From: “Maxim S. Shatskih”
To: “NT Developers Interest List”
Sent: Thursday, June 07, 2001 6:40 AM
Subject: [ntdev] RE: Silly question on IA64

> > What is the difference between casting to a ULONG, and casting to a
PVOID?
> > If you ++ either one, they both increment by one. If you add 0x10, they
>
> Can PVOID be ++ ed? At least C++ prohibits this because sizeof(void) is a
> nonsense and not zero.
>
> Max
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@acm.org
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Well, howdy doody! As defined in the Win2K DDK, it’s essentially what the
rest of us are doing explicitly, but it’s a lot cleaner. Thanks!

Phil

-----Original Message-----
From: Stephen Williams [mailto:xxxxx@icarus.com]
Sent: Wednesday, June 06, 2001 5:33 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Silly question on IA64

All the systems I do work with have a macro in the system header
files that does the rounding to page boundaries.

xxxxx@intel.com said:

I’ve missed that one, I guess. Would you mind telling us what it is?

In Linux (and if I remember correctly other unices) and Windows 2000,
PAGE_ALIGN(x) does the trick.

Steve Williams “The woods are lovely, dark and deep.
xxxxx@icarus.com But I have promises to keep,
xxxxx@picturel.com and lines to code before I sleep,
http://www.picturel.com And lines to code before I sleep.”


You are currently subscribed to ntdev as: xxxxx@intel.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

It’s only defined as ULONG in the 32bit environment.
For the 64bit env the definition is:
typedef unsigned __int64 ULONG_PTR, *PULONG_PTR;

So, to re-iterate – ULONG is bit-dependent, ULONG_PTR is not and is the most
appropriate base definition.

Regards,

Paul Bunn, UltraBac.com, 425-644-6000
Microsoft MVP - WindowsNT/2000
http://www.ultrabac.com

-----Original Message-----
From: Ramit Bhalla [mailto:xxxxx@wipro.com]
Sent: Wednesday, June 06, 2001 10:44 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Silly question on IA64

Thats because ULONG_PTR is defined as a unsigned long.

As far as I know, U’re not allowed to do any arithmetic like & etc on any
pointer, you need to type cast it to do that.

Ramit.

----- Original Message -----
From: “James Antognini”
Newsgroups: ntdev
To: “NT Developers Interest List”
Sent: Thursday, June 07, 2001 3:14 AM
Subject: [ntdev] Re: Silly question on IA64

> I found this (rounding down to a 64K boundary):
>
> PVOID zits = 0x12345678,
> zits1;
>
> zits1 = (PVOID)((ULONG)zits&0xffff0000);
>
> PBYTE and PCHAR won’t work. But I found that ULONG_PTR does! I’m not
> sure that type was available when I did that piece of code. Certainly I
> wasn’t aware of it. Now I know better, and for all the reasons given in
> the discussion, I prefer to use it.


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

As I confirmed in response to someone else pointing out the obvious, I did
mean PUCHAR.

Phil

-----Original Message-----
From: Maxim S. Shatskih [mailto:xxxxx@storagecraft.com]
Sent: Thursday, June 07, 2001 3:41 AM
To: NT Developers Interest List
Subject: [ntdev] RE: Silly question on IA64

What is the difference between casting to a ULONG, and casting to a PVOID?
If you ++ either one, they both increment by one. If you add 0x10, they

Can PVOID be ++ ed? At least C++ prohibits this because sizeof(void) is a
nonsense and not zero.

Max


You are currently subscribed to ntdev as: xxxxx@intel.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com