Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Freeing double restricted pointer?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
andrew.gottemol...@debesys.net  
View profile  
 More options Nov 5 2012, 11:07 am
Newsgroups: comp.std.c
From: andrew.gottemol...@debesys.net
Date: Mon, 5 Nov 2012 08:07:19 -0800 (PST)
Local: Mon, Nov 5 2012 11:07 am
Subject: Freeing double restricted pointer?
I have a table of string pointers, declared as follows:

char * restrict * restrict table;

Each of the strings in the table is a unique region of memory, only accessible via 'table[index]'.  The array containing the string pointers is also a unique memory region, only accessible via the table variable.

At some point, I'd like to free the table.  I do so via:

free(table);

This results in the following warning from gcc:

test.c:10:5: warning: passing argument 1 of ‘free’ discards ‘restrict’ qualifier from pointer target type [enabled by default]
test.c:2:13: note: expected ‘void *’ but argument is of type ‘char * restrict* restrict’

Is this expected behavior?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
James Kuyper  
View profile  
 More options Nov 5 2012, 5:24 pm
Newsgroups: comp.std.c
From: James Kuyper <jameskuy...@verizon.net>
Date: Mon, 05 Nov 2012 17:24:08 -0500
Local: Mon, Nov 5 2012 5:24 pm
Subject: Re: Freeing double restricted pointer?
On 11/05/2012 11:07 AM, andrew.gottemol...@debesys.net wrote:

Passing an argument to a function is subject to the same constraints as
would apply to an assignment of that argument to the corresponding
parameter (6.5.2.2p2). The permitted combinations of source and
destination types for assignment are listed in 6.5.16.1p1. The fourth
combination is the one that comes closest to this case: it allows the
source and destination to both be pointer types, with either one a
pointer to void, but it requires that the destination type have all of
the same qualifiers as the source. 'restrict' is a qualifier, so passing
a restrict qualified pointer to a function when the corresponding
parameter doesn't have the same qualifiers violates that constraint. At
least one diagnostic message is required when processing a program
containing any syntax errors or constraint violations - you got two
messages, so technically you could say that the second one was
unexpected, but the standard never prohibits the generation of extra
messages

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »