Skip to Content.
Sympa Menu

c-semantics - Re: [C-Semantics] C question about const

c-semantics AT lists.cs.illinois.edu

Subject: C Semantics in K Framework

List archive

Re: [C-Semantics] C question about const


Chronological Thread 
  • From: Chucky Ellison <cme AT freefour.com>
  • To: Derek M Jones <derek AT knosof.co.uk>
  • Cc: Dwight Guth <dguth2 AT illinois.edu>, "c-semantics AT cs.illinois.edu" <c-semantics AT cs.illinois.edu>, chris hathhorn <hathhorn AT gmail.com>, Pascal Cuoq <pascal.cuoq AT gmail.com>
  • Subject: Re: [C-Semantics] C question about const
  • Date: Fri, 20 Feb 2015 17:06:08 -0500
  • List-archive: <http://lists.cs.uiuc.edu/pipermail/c-semantics/>
  • List-id: C Semantics in K Framework <c-semantics.cs.illinois.edu>

Doesn't being a constraint violation make it undefined?  I can't really find what the point of constraints are in the standard, but I've always assumed constraint violations were undefined.

All I can find talking around it are 

- constraint: "restriction, either syntactic or semantic, by which the exposition of language elements is to be interpreted"
and then this beast
- If a ‘‘shall’’ or ‘‘shall not’’ requirement that appears outside of a constraint or runtime-constraint is violated, the behavior is undefined.
This seems to leave unexplained what happens if a shall or shall not requirement that appears INSIDE a constraint or runtime-constraint is violated, but its existence may imply it's not undefined.

At any rate, the behavior certainly doesn't seem DEFINED.

What gives?  And what do you think about how not being able to cast away const means we can't keep const pointers we eventually free?  Seems limiting to me.

-Chucky

On Thu, Feb 19, 2015 at 9:47 AM, Derek M Jones <derek AT knosof.co.uk> wrote:
Chucky,

Good to hear from you.  Hope you are having fun.

int * p3 = p2; // I think this is undefined, since the case is not listed
in 6.3.2.3 or anywhere else I can tell

Its a constraint violation, 6.7.8p11 -> 6.5.16.1p1


--
Derek M. Jones           Software analysis
tel: +44 (0)1252 520667  blog:shape-of-code.coding-guidelines.com




Archive powered by MHonArc 2.6.16.

Top of Page