Re: Casting the return value of malloc()...



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"
.



Relevant Pages

  • Re: C_LOC and character string
    ... standard requires. ... as the quoted material is meaningless in that context. ... some presumed declaration of some presumed entity. ... instead as a separate requirement in addition to type interoperability ...
    (comp.lang.fortran)
  • Re: template syntax...
    ... It very much depends on your declaration of ... whether it's OK (call it compliant, standard, valid, legal, or whatever) ... then how can anybody tell you if you don't supply the context? ...
    (comp.lang.cpp)
  • Re: Nice a tight loop?
    ... That section of man pages is titled "Standard C Library Functions"; ... There is also a POSIX standard; this is what we often consider our "standard" in our documentation, when we refer to such functions outside of the context of ISO C. ...
    (comp.lang.c)
  • Re: C as a scripting language
    ... in the context of the C Standard. ... This question is being raised in the context of section 4p5, which does not restrict the 'output' to be stream output. ... However, those same definitions also exclude data written to a file, for precisely the same reason: for some of those definitions, the reason is that the data is not perceived by the user; for other definitions, it is because the data has not exited the computer system. ...
    (comp.lang.c)
  • Re: Is this math test too easy?
    ... >> has a direct meaning unabmbiously and independant from context. ... even have a notation like circle addition or circle multiplication ... that MEANS that it doesn't have a standard interpretation, ... the main problem with standardizing notation is ...
    (sci.math)