ANSI C & C++ idea

serge at ucbvax.UUCP serge at ucbvax.UUCP
Wed Feb 25 11:31:27 AEST 1987


[]
    I would like to propose the following notation (valid only in function
argument declarations/definitions)

	void	f(return Type *t)

to mean that f() will only write the value pointed to by t, and not read it.

    That is,

	void	f(const Type *t)

would mean that f() only reads *t, and does not write it, while

	void	f(return Type *t)

would mean that f() only writes *t, and does not read it, and

	void	f(Type *t)

would mean that f() both reads and writes *t, e.g. t is a
value-result parameter.

    In addition, an argument declared as

	Type *t

could be passed to a function expecting a parameter of type

	const Type *t
or
	return Type *t
or
	Type	*t

    However, an argument declared as

	return Type *t

could only be passed to a function expecting a parameter of type

	return Type *t

and an argument declared as

	const	Type *t

could only be passed to a function expecting a parameter of type

	const	Type *t

    Comments?

						Serge
						serge at ucbvax.berkeley.edu
						...!ucbvax!serge



More information about the Comp.lang.c mailing list