My gets_ws function

R

Richard Heathfield

Dietmar Schindler said:
The first is no more or less meaningful than the second. You correctly
stated "The *only* thing you can pass to a function via the parameter
mechanism is a value...", so the "value" part is dispensable, but not
meaningless.

Yes, the "by value" part is always true and therefore dispensable, but what
then remains is "pass a pointer" (which is meaningful because a pointer
/is/ a value - the fact that such a value can be stored in an object is
irrelevant), or "pass a variable" (which is not meaningful). So I stand by
my original statement.
 
D

Dietmar Schindler

Richard said:
Dietmar Schindler said:


Yes, the "by value" part is always true and therefore dispensable, but what
then remains is "pass a pointer" (which is meaningful because a pointer
/is/ a value - the fact that such a value can be stored in an object is
irrelevant), or "pass a variable" (which is not meaningful). So I stand by
my original statement.

The statement "a pointer /is/ a value" and wording in the C standard
(n1124) clash. Examples:

6.7.3.1 #12: "The one exception allows the value of a restricted pointer
to be carried out of the block ..."

7.19.3 #4: "The value of a pointer to a FILE object is indeterminate
after the associated file is closed ..."

7.20.3.4 #4: "The realloc function returns a pointer to the new object
(which may have the same value as a pointer to the old object)..."

This all suggests that a pointer /has/ a value and not that it /is/ one.

Thus, "pass a pointer" is just shorthand for "pass a pointer's value",
and so is "pass a variable" just shorthand for "pass a variable's value"
and by no means not meaningful.
 
J

Joe Wright

Dietmar said:
The statement "a pointer /is/ a value" and wording in the C standard
(n1124) clash. Examples:

6.7.3.1 #12: "The one exception allows the value of a restricted pointer
to be carried out of the block ..."

7.19.3 #4: "The value of a pointer to a FILE object is indeterminate
after the associated file is closed ..."

7.20.3.4 #4: "The realloc function returns a pointer to the new object
(which may have the same value as a pointer to the old object)..."

This all suggests that a pointer /has/ a value and not that it /is/ one.

Thus, "pass a pointer" is just shorthand for "pass a pointer's value",
and so is "pass a variable" just shorthand for "pass a variable's value"
and by no means not meaningful.

The word 'pointer' is overworked in C unfortunately. It is a variable,
to be sure, but its usage as a value is pervasive. I used to fight the
fight of 'pointer/object' and 'address/value' but nobody wants to play.
We insist that the value returned by malloc() is a pointer instead of a
value. Too bad.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,184
Messages
2,570,978
Members
47,561
Latest member
gjsign

Latest Threads

Top