Re: Casting the return value of malloc()...
- From: Keith Thompson <kst-u@xxxxxxx>
- Date: Wed, 25 Nov 2009 14:28:00 -0800
Kaz Kylheku <kkylheku@xxxxxxxxx> writes:
On 2009-11-25, Phil Carmody <thefatphil_demunged@xxxxxxxxxxx> wrote:
Eric Sosman <esosman@xxxxxxxxxxxxxxxxxxxx> writes:
My argument boils down to this: The Standard does not use the
term "operator" to refer to `while', so we shouldn't use it that
way either.
Works for me.
Have you checked all of the normative references? Maybe ISO 2382-1 has
a definition for operator. I don't have this document.
The C standard does define the word "operator".
C99 6.4.6p2:
A punctuator is a symbol that has independent syntactic and
semantic significance. Depending on context, it may specify an
operation to be performed (which in turn may yield a value or a
function designator, produce a side effect, or some combination
thereof) in which case it is known as an _operator_ (other forms
of operator also exist in some contexts). An _operand_ is an
entity on which an operator acts.
Underscores denote italics in the standard.
I suppose there's some wiggle room in the statement that "other
forms of operator also exist in some contexts", but the standard
*never* uses the word "operator" in a way that allows "return"
to be considered an operator. Probably it refers to the "sizeof"
and cast operators, which don't take the form of punctuators.
The term ``local variable'' also cannot be found in the standard.
Good luck convincing the world to say ``object with automatic storage
duration''.
I've found that people using the term "local variable" tend not to
make the distinction between scope and storage duration. C, along
with its descendants, is a bit unusual in making this distinction.
This isn't to suggest that people using the term "local variable"
don't understand the distinction; typically it doesn't matter in the
particular context being discussed.
The standard does use the term ``local'' in several places without really
defining what it means. The term ``variable'' (as a noun) also appears in
normative text, but it is not defined.
First occurence: 6.8.5.3 The for statement.
``If clause-1 is a declaration, the scope of any variables it declares
is the remainder of the declaration and the entire loop, including the
other two expressions; it is reached in the order of execution before
the first evaluation of the controlling expression.''
Maybe it's found in ISO 2382-1.
That doesn't turn out to be a good example. The text you quote
does appear in the C99 standard, but not in N1256. The change is
in TC3, changing "variables" to "identifiers", in response to DR
#292, <http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_292.htm>.
(The DR proposed the word "objects"; the committee response changed
it to "identifiers".)
Note that the committee did not make most of the suggested changes.
I haven't studied them all, but apparently they felt that the use
of the word "variable" is acceptable in non-normative text, such
as footnotes. (Not unreasonable, IMHO.)
--
Keith Thompson (The_Other_Keith) kst-u@xxxxxxx <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
.
- References:
- Common misconceptions about C (C95)
- From: Ioannis Vranos
- Re: Casting the return value of malloc()...
- From: gwowen
- Re: Casting the return value of malloc()...
- From: Richard Harter
- Re: Casting the return value of malloc()...
- From: Joe Wright
- Re: Casting the return value of malloc()...
- From: Richard Tobin
- Re: Casting the return value of malloc()...
- From: Kaz Kylheku
- Re: Casting the return value of malloc()...
- From: Eric Sosman
- Re: Casting the return value of malloc()...
- From: Kaz Kylheku
- Re: Casting the return value of malloc()...
- From: Eric Sosman
- Re: Casting the return value of malloc()...
- From: Phil Carmody
- Re: Casting the return value of malloc()...
- From: Kaz Kylheku
- Common misconceptions about C (C95)
- Prev by Date: Re: Remember?
- Next by Date: Re: Casting the return value of malloc()...
- Previous by thread: Re: Casting the return value of malloc()...
- Next by thread: Re: Casting the return value of malloc()...
- Index(es):
Relevant Pages
|