Skip to Content.
Sympa Menu

c-semantics - Re: [C-Semantics] function prototype scope

c-semantics AT lists.cs.illinois.edu

Subject: C Semantics in K Framework

List archive

Re: [C-Semantics] function prototype scope


Chronological Thread 
  • From: Derek M Jones <derek AT knosof.co.uk>
  • To: c-semantics AT cs.illinois.edu
  • Subject: Re: [C-Semantics] function prototype scope
  • Date: Sat, 18 Jun 2011 18:28:12 +0100
  • 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,

int sub (int i, int array[i++]) {
...
I'm pretty sure this is "function prototype scope" and that "i++" is

No it isn't.
Sentence 403: http://c0x.coding-guidelines.com/6.2.1.html
Also see sentence 408.

not an integer constant expression, so it should be treated like a
"*". My understanding of the "*" in array declarators is fuzzy, but I
don't think they are allowed to be used in a definition, only in a
function declaration. Indeed, all of the compilers complain with an
error if I try:
int sub (int i, int array[*]) { ... }
Instead, doing this:
int sub (int i, int array[*]);
int sub (int i, int array[10]) { ... }
compiles and runs.

If i++ is supposed to be evaluated (although I don't know how, based
on the above 6.7.6.2:5), then when does it get evaluated? During
every call? At definition time? Are the side effects guaranteed to
occur? Where should I be looking in the standard instead of the
quotes above?

Does anyone know what is going on here?

-Chucky
_______________________________________________
c-semantics mailing list
c-semantics AT cs.illinois.edu
http://lists.cs.uiuc.edu/mailman/listinfo/c-semantics


--
Derek M. Jones tel: +44 (0) 1252 520 667
Knowledge Software Ltd
mailto:derek AT knosof.co.uk
Source code analysis http://www.knosof.co.uk




Archive powered by MHonArc 2.6.16.

Top of Page