This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Fix comment typos in std_valarray.h


Gabriel Dos Reis wrote:

> Volker Reichelt <reichelt@igpm.rwth-aachen.de> writes:
> 
> | The following patch fixes several comment typos in std_valarray.h:
> 
> |         *  Assign elements of array to values in @a v.  Results are undefined
> | -       *  if @a v is not the same size as this array.
> | +       *  if @a v has not the same size as this array.
> 
> I guess, that was supposed to read "if @a v is not of the same size...."
> but, you version is fine too.

Not quite.

The original is fine, Gaby's version is fine, but Volker's is not good
English.  You never say "A has not B" in English, you say "A does not
have B."

So that should be "if @a v does not have the same size as this array."

It might be technically more accurate as "if the size of @a v is not the
same as the size of this array" but that's a bit of a mouthful.

Personally I prefer the original, or "does not have."


        *  Returns a new valarray containing the elements of the array
-       *  indicated by the slice argument.  The new valarray is the size of
+       *  indicated by the slice argument.  The new valarray has the size of
        *  the input slice.  @see slice.

That should probably be "has the same size as the input slice"


        *  in shifted positions.  For an element with index i, the new position
-       *  is (i - n) % size().  The new valarray is the same size as the
+       *  is (i - n) % size().  The new valarray has the same size as the
        *  current one.

That's perfect.


-       *  Resize this array to be @a size and set all elements to @a c.  All
+       *  Resize this array to have @a size and set all elements to @a c.

I don't like the original or the new version much.  I would prefer
"to have size @a size" or "to have length @a size," but I think my first
choice would be "Resize this array to @a size."   That works best if you
substitute some value for "size" e.g. "Resize to fifteen."

FWIW the standard talks about lengths, not sizes, e.g.
"The resulting behavior is undefined if the length of the argument array
is not equal to the length of the *this array."

jon

-- 
"It is always the best policy to tell the truth, unless, of course, you 
 are an exceptionally good liar."
	- Jerome K. Jerome


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]