有效性 [英] ptrs validity

查看:69
本文介绍了有效性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个指向未知堆内存块的指针,是否有可能

检查指针+ 3是否有效?

如果不可能,我该如何检查?

谢谢

Hi,
I have a pointer that points to an unknown heap memory block, is it possible
to check the pointer + 3 is valid or not?
If it is impossible, how can I do the check?
Thanks

推荐答案

a表示:
a said:



我有一个指向未知堆内存块的指针,是吧

可以检查指针+ 3是否有效?
Hi,
I have a pointer that points to an unknown heap memory block, is it
possible to check the pointer + 3 is valid or not?



No.

No.


如果不可能,我该怎么办?
If it is impossible, how can I do the check?



你不能。这是不可能的。


-

Richard Heathfield

Usenet是一个奇怪的地方 - dmr 29/7/1999
http://www.cpax.org.uk

电子邮件:rjh在上面的域名(但显然放弃了www)

You can''t. It''s impossible.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)


" a" < a@mail.comwrote:
"a" <a@mail.comwrote:

我有一个指向未知堆内存块的指针,是否可以检查
指针+ 3是否有效?
I have a pointer that points to an unknown heap memory block, is it possible
to check the pointer + 3 is valid or not?



No.

No.


如果不可能,我该怎么办?
If it is impossible, how can I do the check?



如果不可能,那是不可能的。


Richard

If it is impossible, it is impossible.

Richard


aaécrit:
a a écrit :



我有一个指向未知堆内存块的指针,是否可能

检查指针+ 3是否有效?

如果不可能,我该如何检查?

谢谢

Hi,
I have a pointer that points to an unknown heap memory block, is it possible
to check the pointer + 3 is valid or not?
If it is impossible, how can I do the check?
Thanks



这取决于操作系统。


在Windows操作系统下你可以使用:

IsBadReadPtr(ptr,size)


在你的情况下将是


IsBadReadPtr(ptr,3);


其他操作系统可能有其他方法。


jacob

It depends on the operating system.

Under the windows OS you can use:

IsBadReadPtr(ptr, size)

in your case would be

IsBadReadPtr(ptr,3);

Other operating systems maybe have other methods.

jacob


这篇关于有效性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆