[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.c

To: People who write standards

d3x0xr

5/30/2016 2:21:00 PM

In the other two Postings...

const - and valid conversions of pointers thereto
a more verbose discussion const and conversions

I discussed the existing standards, and discussed several examples of
the various permutations of the declaration of const....

I have been told by several people that my 'interpretation is wrong
about what const it' and that it does not mean what I mean, then
continue to say that it does not force data to remain the same, becuase
aliasing etc can subvert the whole scheme and render any use of const as
mute.

The point I'd really like to see be made is that const should be an
advisory, a declared statement of intent not to modify data. And one
conversion which should always be safe (and not generate a warning) is
any conversion which gains the const attribute at any level.

I'd like to see people be able to declare

void f ( const char * * dont_modify_my_chars )
{
}
and use

{
char buffer[256];
char * buf2 = buffer;
f(&buf2);
}


5 Answers

Alan Balmer

11/30/2006 4:18:00 PM

0

On wed, 29 nov 2006 19:38:50 -0800, "d3x0xr" <d3x0r@nowhere.net>
wrote:

>In the other two Postings...
>
>const - and valid conversions of pointers thereto
>a more verbose discussion const and conversions
>
>I discussed the existing standards, and discussed several examples of
>the various permutations of the declaration of const....

I saw neither of those postings, since I limit the size of newsgroup
downloads, but judging from the above, you're probably in the wrong
newsgroup. Perhaps you want comp.std.c?

--
Al Balmer
Sun City, AZ

CBFalconer

12/1/2006 2:12:00 AM

0

Al Balmer wrote:
> "d3x0xr" <d3x0r@nowhere.net> wrote:
>
>> In the other two Postings...
>>
>> const - and valid conversions of pointers thereto
>> a more verbose discussion const and conversions
>>
>> I discussed the existing standards, and discussed several examples
>> of the various permutations of the declaration of const....
>
> I saw neither of those postings, since I limit the size of newsgroup
> downloads, but judging from the above, you're probably in the wrong
> newsgroup. Perhaps you want comp.std.c?

I saw neither, and I don't limit the downloads. I think the OP has
made a mistake or two. Or his ISP has lost touch with the net.
Etc. Usenet is not a reliable medium.

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.a...


Alan Balmer

12/1/2006 4:31:00 PM

0

On Thu, 30 Nov 2006 21:12:07 -0500, CBFalconer <cbfalconer@yahoo.com>
wrote:

>Al Balmer wrote:
>> "d3x0xr" <d3x0r@nowhere.net> wrote:
>>
>>> In the other two Postings...
>>>
>>> const - and valid conversions of pointers thereto
>>> a more verbose discussion const and conversions
>>>
>>> I discussed the existing standards, and discussed several examples
>>> of the various permutations of the declaration of const....
>>
>> I saw neither of those postings, since I limit the size of newsgroup
>> downloads, but judging from the above, you're probably in the wrong
>> newsgroup. Perhaps you want comp.std.c?
>
>I saw neither, and I don't limit the downloads. I think the OP has
>made a mistake or two. Or his ISP has lost touch with the net.
>Etc. Usenet is not a reliable medium.

I actually download the headers, and they indicated some enormous
number of lines, several times my limit of 200. Looking at the subject
lines, the author, and the shorter post which did come through, it was
easy to decide *not* to instruct the reader to fetch them.

--
Al Balmer
Sun City, AZ

CBFalconer

12/1/2006 5:16:00 PM

0

Al Balmer wrote:
> CBFalconer <cbfalconer@yahoo.com> wrote:
>> Al Balmer wrote:
>>> "d3x0xr" <d3x0r@nowhere.net> wrote:
>>>
>>>> In the other two Postings...
>>>>
>>>> const - and valid conversions of pointers thereto
>>>> a more verbose discussion const and conversions
>>>>
>>>> I discussed the existing standards, and discussed several examples
>>>> of the various permutations of the declaration of const....
>>>
>>> I saw neither of those postings, since I limit the size of newsgroup
>>> downloads, but judging from the above, you're probably in the wrong
>>> newsgroup. Perhaps you want comp.std.c?
>>
>> I saw neither, and I don't limit the downloads. I think the OP has
>> made a mistake or two. Or his ISP has lost touch with the net.
>> Etc. Usenet is not a reliable medium.
>
> I actually download the headers, and they indicated some enormous
> number of lines, several times my limit of 200. Looking at the subject
> lines, the author, and the shorter post which did come through, it was
> easy to decide *not* to instruct the reader to fetch them.

Another possibility is that the OP included attachments, and the
result passed through a system that (rightly) deleted articles with
attachments.

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.a...


lawrence.jones

12/1/2006 7:09:00 PM

0

d3x0xr <d3x0r@nowhere.net> wrote:
>
> And one
> conversion which should always be safe (and not generate a warning) is
> any conversion which gains the const attribute at any level.

That is simply not correct, it would allow you to inadvertently attempt
to modify a const object. For example:

const char c = 'c';
char *pc;
const char **pcc = &pc;
*pcc = &c;
*pc = 'C';

-Larry Jones

Moms and reason are like oil and water. -- Calvin