限制 [英] restrict

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

问题描述



restrict关键字的目的是什么?

gc

解决方案

< blockquote>文章< 79 ************************* @ posting.google.com> ,gc写道:


restrict关键字的目的是什么?




指针指向的数据使用restrict

限定符声明的任何其他指针都可能无法指向。这个

允许更有效的优化。


例如,用作memcpy()参数的两个指针是

声明有限制,这只是意味着两个数据

区域可能不会重叠。


-

Andreas K?h? ri |

|让它白痴证明,有人会把它包起来

|在功能失常的GUI中。


Andreas Kahari写道:

gc写道:

restrict关键字的用途是什么?







用limit
限定符声明的指针指向的数据可能不会被任何其他指针指向。这允许更有效的优化。

例如,用作memcpy()
的参数的两个指针是用restrict声明的,这只是意味着这两个数据区域可能不重叠。




你介意对此进行详细说明吗?

我的memcpy没有使用* restrict *关键字:


MEMCPY(3)Linux程序员手册MEMCPY(3)


名称

memcpy - copy记忆区


简介

#include< string.h>


void * memcpy(void * dest ,const void * src,size_t n);


在文章< 3F ************ @ jpl.nasa.gov>中,E。Robert Tisdale写道:

Andreas Kahari写道:

gc写道:

restrict关键字的目的是什么?


[cut]例如,用作memcpy()
参数的两个指针是用restrict声明的,这只是意味着两个数据区域可能不重叠。



你能不能详细说明一下?
我的memcpy没有使用* restrict *关键字:




C isn'由Linux手册页定义。


我之所以选择这个例子是因为这不是

标准的例子,还是理由)使用。后来,标准

确实将memcpy()定义为两个限制指针。对于声称与POSIX兼容的Unix类型系统,请参阅

单一Unix规范

http://www.opengroup.org/onlinepubs/...ns/memcpy.html

Andreas K?h?ri |

|让它白痴证明,有人会把它包起来

|功能失常的GUI。


Hi,
What is the purpose of the restrict keyword?
gc

In article <79*************************@posting.google.com> , gc wrote:

Hi,
What is the purpose of the restrict keyword?



The data pointed to by a pointer declared with the restrict
qualifier may not be pointed to by any other pointer. This
allows for more effective optimization.

For example, the two pointers used as arguments to memcpy() are
declared with restrict, which simply means that the two data
areas may not overlap.

--
Andreas K?h?ri |
| Make it idiot proof, and someone will wrap it
| in a dysfunctional GUI.


Andreas Kahari wrote:

gc wrote:

What is the purpose of the restrict keyword?



The data pointed to by a pointer declared with the restrict
qualifier may not be pointed to by any other pointer.
This allows for more effective optimization.

For example, the two pointers used as arguments to memcpy()
are declared with restrict, which simply means that
the two data areas may not overlap.



Would you mind elaborating a little on this?
My memcpy doesn''t use the *restrict* keyword:

MEMCPY(3) Linux Programmer?s Manual MEMCPY(3)

NAME
memcpy - copy memory area

SYNOPSIS
#include <string.h>

void *memcpy(void *dest, const void *src, size_t n);


In article <3F************@jpl.nasa.gov>, E. Robert Tisdale wrote:

Andreas Kahari wrote:

gc wrote:

What is the purpose of the restrict keyword?

[cut] For example, the two pointers used as arguments to memcpy()
are declared with restrict, which simply means that
the two data areas may not overlap.



Would you mind elaborating a little on this?
My memcpy doesn''t use the *restrict* keyword:



C isn''t defined by Linux manual pages.

I chose that example because th?t''s the example that the
standard )or was it the rationale) uses. Later, the standard
indeed defines memcpy() as taking two restrict pointers. For
Unix-type systems that claims to be POSIX compatible, see also
the Single Unix Specification at

http://www.opengroup.org/onlinepubs/...ns/memcpy.html

--
Andreas K?h?ri |
| Make it idiot proof, and someone will wrap it
| in a dysfunctional GUI.


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

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