Skip to Content.
Sympa Menu

c-semantics - Re: [C-Semantics] &*Exp

c-semantics AT lists.cs.illinois.edu

Subject: C Semantics in K Framework

List archive

Re: [C-Semantics] &*Exp


Chronological Thread 
  • From: Derek M Jones <derek AT knosof.co.uk>
  • To: c-semantics AT cs.illinois.edu
  • Subject: Re: [C-Semantics] &*Exp
  • Date: Wed, 18 Jan 2012 01:32:13 +0000
  • List-archive: <http://lists.cs.uiuc.edu/pipermail/c-semantics>
  • List-id: C Semantics in K Framework <c-semantics.cs.illinois.edu>
  • Organization: Knowledge Software, Ltd

Chucky,

I was writing some tests for this for kcc and hit on the following expression:
&(&(*(*(void**)NULL))) == (void**)NULL
I'd argue that based on the standard,&(&(*(*(void**)NULL))) is "as
if" it were&(*(void**)NULL), which is "as if" it were (void**)NULL.

I disagree. Operators (and their associated constraints) have to be
applied in a given order. The exception wording requires that any
constraints still apply before the runtime consequences of &* can be
ignored. Your code violates the constraints diagnosed by gcc et al.

The following is fine (and not interesting):

&(*(&(*(void**)NULL))) == (void**)NULL

--
Derek M. Jones tel: +44 (0) 1252 520 667
Knowledge Software Ltd blog:shape-of-code.coding-guidelines.com
Source code analysis http://www.knosof.co.uk




Archive powered by MHonArc 2.6.16.

Top of Page