Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #85705

Re: string array demaged at unknown moment

From Keith Thompson <Keith.S.Thompson+u@gmail.com>
Newsgroups comp.lang.c++
Subject Re: string array demaged at unknown moment
Date 2022-07-27 13:05 -0700
Organization None to speak of
Message-ID <874jz2xqw1.fsf@nosuchdomain.example.com> (permalink)
References <tbs1si$2pq4g$1@portraits.wsisiz.edu.pl> <books-20220727201443@ram.dialup.fu-berlin.de>

Show all headers | View raw


ram@zedat.fu-berlin.de (Stefan Ram) writes:
> Jivanmukta <jivanmukta@poczta.onet.pl> writes:
>>     bool get_next_line(std::string &line);
> ...
>>                                                      get_next_line() 
>>returns spoilt line.
>
>   You complain about get_next_line, yet you only show us its
>   declaration, not its implementation. This means that you are
>   still missing basics of C++ class implementation. You need to
>   learn the fundamentals of C++ /before/ you can begin to edit
>   such class implementations.

The fact that the OP didn't show us the implementation of a function
doesn't necessarily imply anything about their knowledge of C++.
We all forget things now and then.

>   One might also add that get_next_line returns a bool, so it
>   can never return a line.

Right, but it takes a std::string by reference, so it can update its
value.  Saying that it "returns" a string is imprecise, but not horribly
so.

[...]

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Philips
void Void(void) { Void(); } /* The recursive call of the void */

Back to comp.lang.c++ | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

string array demaged at unknown moment Jivanmukta <jivanmukta@poczta.onet.pl> - 2022-07-27 20:58 +0200
  Re: string array demaged at unknown moment Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2022-07-27 13:05 -0700

csiph-web