Liste des Groupes | Revenir à cl c |
On Fri, 14 Feb 2025 21:02:19 +0100
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
On 14.02.2025 20:38, James Kuyper wrote:>>
As with several of the string processing functions, I think fgets()
would be better if it returned a pointer to the end of the data
that was read in, rather than to the beginning.
Yes, that's another option. The language designer have to decide which
behavior is more useful. There's pros and cons, IMO.
IMHO, there are no cons.
Returning pointer to the end of data is very obviously superior.
On the minus side
would be that the origin of the string gets lost that way.
Huh?
How could you lose something you just passed to the function?
In most typical code, it's not even a complex expression or pointer,
but name of array.
(Of course
you can adjust your code then to keep a copy. But any way implemented,
you need to adjust your code according to how the function is
defined.)
>
Les messages affichés proviennent d'usenet.