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


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

Re: string array demaged at unknown moment

Path csiph.com!weretis.net!feeder8.news.weretis.net!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From Keith Thompson <Keith.S.Thompson+u@gmail.com>
Newsgroups comp.lang.c++
Subject Re: string array demaged at unknown moment
Date Wed, 27 Jul 2022 13:05:50 -0700
Organization None to speak of
Lines 30
Message-ID <874jz2xqw1.fsf@nosuchdomain.example.com> (permalink)
References <tbs1si$2pq4g$1@portraits.wsisiz.edu.pl> <books-20220727201443@ram.dialup.fu-berlin.de>
MIME-Version 1.0
Content-Type text/plain
Injection-Info reader01.eternal-september.org; posting-host="4cade4b69894ce75454f6fba9132da96"; logging-data="2756634"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+zfl4Hqp6oX6hA7WaKbTEb"
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock sha1:5W8c+MSpRZlYrBvZ7fYNS4q4yWc= sha1:xuikfmvZrvHAUZEZjpSsgSdkRWw=
Xref csiph.com comp.lang.c++:85705

Show key headers only | 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