473,890 Members | 1,659 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

what is restrict keyword used for

what is restrict keyword used for?

eg int *restrict p;
Sep 2 '08
23 4860
Pilcrow wrote:
vi******@gmail. com wrote:
>raashid bhatt <raashidbh...@g mail.comwrote:
>>what is restrict keyword used for?

eg int *restrict p;

See 6.7.3.1 Formal definition of restrict.

Pardon my ignorance, but to what document does that string of
numbers refer?
The C standard. See below for references for PDF and compressed
text varieties.

--
Some useful references about C:
<http://www.ungerhu.com/jxh/clc.welcome.txt >
<http://c-faq.com/ (C-faq)
<http://benpfaff.org/writings/clc/off-topic.html>
<http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf(C99)
<http://cbfalconer.home .att.net/download/n869_txt.bz2(C9 9, txt)
<http://www.dinkumware. com/c99.aspx (C-library}
<http://gcc.gnu.org/onlinedocs/ (GNU docs)
<http://clc-wiki.net/wiki/C_community:com p.lang.c:Introd uction>
Sep 5 '08 #11
Nick Keighley <ni************ ******@hotmail. comwrites:
On Sep 5, 8:26*am, Pilcrow <pilc...@pp.inf owrote:
>On Mon, 1 Sep 2008 21:44:53 -0700 (PDT), vipps...@gmail. com wrote:
[...]
>See 6.7.3.1 Formal definition of restrict.

Pardon my ignorance, but to what document does that string of numbers
refer?

the (or a) C standard. In this case it will be the ISO
1999 C Standard (aka C99). Earlier versions of the standard
did not include restict. Here's a draft of the standard,
the paragraph numbers don't tie up tho :-(

http://wwwold.dkuug.dk/jtc1/sc22/open/n2794/n2794.txt
That's a plain-text version of a pre-C99 draft, dated August 3, 1998.
(It's actually N843; I wonder why the file is called n2794.txt.)

CBFalconer often recommends a plain-text version of n869, a later
pre-standard draft.

There are no plain-text versions of the actual standard or of the
later drafts. Plain text loses some semantically significant
formatting information. I recommend n1256.pdf unless you have serious
difficulties dealing with PDF files.

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Sep 5 '08 #12
Nick Keighley <ni************ ******@hotmail. comwrites:
On Sep 5, 8:26¬*am, Pilcrow <pilc...@pp.inf owrote:
>On Mon, 1 Sep 2008 21:44:53 -0700 (PDT), vipps...@gmail. com wrote:
>On Sep 2, 7:22 am, raashid bhatt <raashidbh...@g mail.comwrote:
>what is restrict keyword used for?
>eg int *restrict p;

google "c restrict" gives many hits. This is the first I got
http://developers.sun.com/solaris/ar..._restrict.html

basically "restrict" qualified parameters specify that
there is no aliasing going on
Yup, but...
int f (restict int *a, restrict int *b)
as you say it the parameters that must be marked:

int f (int *restict a, int *restrict b)

not the ints to which they point.

--
Ben.
Sep 5 '08 #13
Keith Thompson <ks***@mib.orgw rote:
>
That's a plain-text version of a pre-C99 draft, dated August 3, 1998.
(It's actually N843; I wonder why the file is called n2794.txt.)
Because the complete numbers are WG14/N843 and SC22/N2794: the working
group's document was redistributed by the parent subcommittee and thus
given one of their document numbers.
--
Larry Jones

I don't see why some people even HAVE cars. -- Calvin
Sep 5 '08 #14
la************@ siemens.com writes:
Keith Thompson <ks***@mib.orgw rote:
>That's a plain-text version of a pre-C99 draft, dated August 3, 1998.
(It's actually N843; I wonder why the file is called n2794.txt.)

Because the complete numbers are WG14/N843 and SC22/N2794: the working
group's document was redistributed by the parent subcommittee and thus
given one of their document numbers.
Well, I'm glad it's not confusing or anything.

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Sep 5 '08 #15
On Sep 5, 4:38 pm, Keith Thompson <ks...@mib.orgw rote:
vipps...@gmail. com writes:
On Sep 5, 10:26 am, Pilcrow <pilc...@pp.inf owrote:
On Mon, 1 Sep 2008 21:44:53 -0700 (PDT), vipps...@gmail. com wrote:

See 6.7.3.1 Formal definition of restrict.
Pardon my ignorance, but to what document does that string of numbers
refer?
Lewis Carroll - Alice's Adventures in Wonderland

Was that really necessary? It was a reasonable question.
No it wasn't, it was a silly post.
However, I'm suspicious of this Pilcrow person. He talks to kenny and
twink a bit too much. Maybe he's just a usenet/clc newbie...
I was referring to ISO/IEC 9899:1999.
Sep 6 '08 #16
On Fri, 5 Sep 2008 22:58:05 -0700 (PDT), vi******@gmail. com wrote:
>On Sep 5, 4:38 pm, Keith Thompson <ks...@mib.orgw rote:
>vipps...@gmail .com writes:
On Sep 5, 10:26 am, Pilcrow <pilc...@pp.inf owrote:
On Mon, 1 Sep 2008 21:44:53 -0700 (PDT), vipps...@gmail. com wrote:

See 6.7.3.1 Formal definition of restrict.
>Pardon my ignorance, but to what document does that string of numbers
refer?
Lewis Carroll - Alice's Adventures in Wonderland

Was that really necessary? It was a reasonable question.

No it wasn't, it was a silly post.
However, I'm suspicious of this Pilcrow person. He talks to kenny and
twink a bit too much. Maybe he's just a usenet/clc newbie...
I was referring to ISO/IEC 9899:1999.
It's Kenny, not kenny.

This is the newsgroup comp.lang.c, which discusses the C programming
language, which is a case sensitive language.

In this newsgroup, kenny != Kenny, at least in terms of identifier
equivalence.

i hope u understand, bcus it is important 2 do so.

Whoops! You're wearing off on me.

I meant to say:

I hope you understand, because it is important to do so.

--
jay
Sep 6 '08 #17
jaysome wrote:
In this newsgroup, kenny != Kenny, at least in terms of identifier
equivalence.
.... and the value of ("kenny" == "kenny") is unspecified.

--
pete
Sep 6 '08 #18
On Sep 6, 10:32 am, pete <pfil...@mindsp ring.comwrote:
jaysome wrote:
In this newsgroup, kenny != Kenny, at least in terms of identifier
equivalence.

... and the value of ("kenny" == "kenny") is unspecified.
He was talking in terms of identifiers, not string literals.
External identifiers can be case insensitive.
jaysome is either a troll or too stupid, but either way, I'm not
bothering with him anymore.
Sep 6 '08 #19
vi******@gmail. com said:

<snip>
jaysome is either a troll or too stupid,
He is neither. Nor is he particularly fond of jumping to conclusions on the
basis of insufficient data.
but either way, I'm not bothering with him anymore.
That's up to you.

--
Richard Heathfield <http://www.cpax.org.uk >
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Sep 6 '08 #20

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

26
3518
by: Steven Bethard | last post by:
I thought it might be useful to put the recent lambda threads into perspective a bit. I was wondering what lambda gets used for in "real" code, so I grepped my Python Lib directory. Here are some of the ones I looked, classified by how I would rewrite them (if I could): * Rewritable as def statements (<name> = lambda <args>: <expr> usage) These are lambdas used when a lambda wasn't needed -- an anonymous function was created with...
2
1293
by: Bodi | last post by:
Hi, Is there a way in SQL Server, or Access to determine what fields are being used in reports or joins, etc? Scenario: Field A in Table 1 is going to be either deleted or change data types, and I'd like to know what impact that will have.
3
2470
by: Petr Prikryl | last post by:
Hi, When solving the problem of passing the unicode directory name through command line into a script (MS Windows environment), I have discovered that I do not understand what encoding should be used to convert the sys.argv into unicode. I know about the rejected attempt to implement sys.argvu. Still, how the sys.argv is filled? What
7
2682
by: tweak | last post by:
Can someone give me a short example as how to best use this keyword in your code? This is my understanding: by definition restrict sounds like it is suppose to restrict access to memory location(s) pointed to, so that only one declared pointer can store that address and access the data in those memory blocks, where I the data in those location(s) can be changed. Is that a correct understanding?
1
1177
by: active | last post by:
I tried to use the help on 'controls' to find out what it is used for but there is so many different uses for the word as to make the help useless. So I tried the following. It appears the second statement adds a new tabpage at the right of the existing pages. The third statement inserts the page in front of the existing selected page.
0
2993
by: copx | last post by:
Restrict keyword questions How far does the guarantee that an object is not accessed through another pointer go? I mean, all examples I have seen are simple stuff like: int f (int *restrict x, int *restrict y) { *x = 0; *y = 1; return *x;
6
1896
by: S_K | last post by:
Hi, I've been toying around with interfaces in C#. They are fun but can anybody give me some examples of where interfaces are used and what they are used for? Thanks so much. Steve
0
9977
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
9816
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11218
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10910
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10452
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7161
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5837
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
4260
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3268
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.