Questions tagged [restrict]

Do not use! This tag has multiple meanings depending context. If you are looking for the restrict keyword in C-like languages use [restrict-qualifier] instead.

353 questions
7
votes
1 answer

C++ restrict Semantics

I'm in the process of updating performance critical libraries to use restrict, as implemented in C++11 by g++ and MSVC with the keyword __restrict. This seems to be the most-standard-extension, so I'll use restrict and __restrict…
geometrian
  • 14,775
  • 10
  • 56
  • 132
7
votes
1 answer

how do i restrict ip block -range- using htaccess?

This is the IP range I wish to block 61.19.0.0 - 61.19.255.255 I've google it and found a few information's, but how do you continue the restriction list? First block /18 starting at 0: 0-63 (64 class C addresses) then block /20 starting…
john
  • 133
  • 1
  • 2
  • 8
7
votes
1 answer

What is the purpose of restrict in tmpfile_s?

From C11 draft: C11 (n1570), § K.3.5.1.1 The tmpfile_s function errno_t tmpfile_s(FILE * restrict * restrict streamptr); What is the purpose of the restrict qualifier here? Because there is no other parameters, the compiler is able to know that…
md5
  • 23,373
  • 3
  • 44
  • 93
6
votes
1 answer

Is there a way to tell the C compiler that a pointer has no aliasing stores?

If the C compiler knows that a pointer is not aliased, it can perform many optimizations. For example, if I compile the following function with gcc -O2: int f_noalias(int *arr, int x) { int res = 0; int *p = &arr[17]; *p = x; res +=…
hugomg
  • 68,213
  • 24
  • 160
  • 246
6
votes
1 answer

Confused about C restrict qualifier

First, cppreference has the following to say about restrict: During each execution of a block in which a restricted pointer P is declared (typically each execution of a function body in which P is a function parameter), if some object that is…
user2711115
  • 457
  • 3
  • 18
6
votes
2 answers

Is the restrict keyword meaningless on parameters of unique pointer types?

I've noticed a heavy use of the restrict keyword in one of our legacy projects. I understand the rationale for restrict, but I question its useful-ness when applied to some of these functions. Take the following two examples: void funcA(int…
Trevor Hickey
  • 36,288
  • 32
  • 162
  • 271
5
votes
1 answer

Clang's __restrict is inconsistent?

I was working on highly "vectorizable" code and noted that regarding the C++ __restrict keyword/extension ~, Clang's behavior is different and impractical compared to GCC even in a simple case. For compiler generated code, the slowdown is about 15x…
Etienne M
  • 604
  • 3
  • 11
5
votes
2 answers

SQL Server - Restrict UPDATE to specific columns

Good day. I explain my scenario. There are two users (user1 and user2). I have a table (tblTest) in SQL server with 3 columns (f1,f2,f3). What I want to do is the following: Deny UPDATE to column f2 and grant UPDATE to columns f1 and f3 for user1.…
LukeLuke
  • 71
  • 1
  • 8
5
votes
6 answers

How to restrict access to web application to one machine only?

I need to make sure that every users accessing my web application can do that from one machine only, so 100 users would mean 100 machines. What would be the best solution? Is detecting and storing IP during first login good idea? I think IP might…
spirytus
  • 10,726
  • 14
  • 61
  • 75
4
votes
1 answer

Limited selection in a JTextField/JTextComponent?

Consider a JFormattedTextField (or any JTextComponent, really) wherein there is a prefix and a suffix displayed around what is the actual "text" of the field. For instance, the double 3.5 would be the String (via formatting) "3.50" around which…
Chris J
  • 43
  • 4
4
votes
3 answers

Does C99/C11 restrict type qualifier imply anything for functions without definition?

Suppose we have a function declaration for which we do not have access to its definition: void f(int * restrict p, int * restrict q, int * restrict r); Since we do not know how the pointers will be accessed, we cannot know if a call will trigger…
Acorn
  • 24,970
  • 5
  • 40
  • 69
4
votes
4 answers

Retrieve current Outlook appointment

I need the current appointment. If no current appointment then the next or even previous appointment. I figure to use Restrict to limit the set of appointments, and then choose either the first or last appointment depending on the restrict argument…
Madsn
  • 380
  • 4
  • 9
4
votes
0 answers

Assigning two restrict qualified pointers to the same data in C11?

I have been working a lot with restrict qualified pointers, and I thought of something that, although I wouldn't do it, the fact that it seems to be standard compliant makes me question whether there is something I am missing in my understanding of…
Kyle
  • 878
  • 6
  • 14
4
votes
5 answers

How can I restrict the number of characters entered into an HTML Input with CSS (or jQuery, if necessary)?

I can manipulate a control based on the state of another control, as shown in this jsfiddle, where the state of a Checkbox alters the width and background color of a Textbox. The HTML is: czech Bachs
B. Clay Shannon-B. Crow Raven
  • 8,547
  • 144
  • 472
  • 862
4
votes
1 answer

Does `restrict` affect aliasing of passed pointers to anything but each other

One of the major uses of restrict keyword that was added to C99 is to allow compilers to load something into a register and assume that the register will mirror the state of the variable thus loaded. Given void foo1(int * restrict a, int * restrict…
supercat
  • 77,689
  • 9
  • 166
  • 211
1
2
3
23 24