Sunday, August 23, 2020

Digest for comp.lang.c++@googlegroups.com - 10 updates in 7 topics

Mike Copeland <mrc2323@cox.net>: Aug 23 04:05PM -0700

I am trying something that I'm not sure is meant to work: using
std::ws with text file i/o. I read a line of text from a file into a
std::string variable. Then I try to assign that string value to an
istringstream object (using std::ws) and from there assign it to another
std::string variable.
My intent is to strip the leading whitespace from each text line.
The code below doesn't work. Please advise. TIA
 
using namespace std;
string wstr;
istringstream iss;
[read wstr from text file] // new data record
iss >> skipws; // skip leading whitespace
iss.str(wstr);
string str = iss.str(); // leading whitespace NOT stripped

 
 
--
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
Tim Rentsch <tr.17687@z991.linuxsc.com>: Aug 23 03:19AM -0700

>> bitfields are implemented
 
> Indeed. The standard places pretty much no requirements on how
> the compiler will "pack" the bitfields inside the struct. [...]
 
This claim is debatable. If you want to say it isn't clear what
the C++ standard /does/ require for packing adjacent bitfields,
that's fine, but saying there are no requirements (or even
"pretty much" no requirements) is at the very least open to
debate.
Tim Rentsch <tr.17687@z991.linuxsc.com>: Aug 23 06:38AM -0700

> }
 
> Is absolutely guaranteed to produce the same result on every C
> compiler,
 
Presumably you meant C++ compiler.
 
> even though the standard imposes no such requirement.
 
The program shown has undefined behavior.
Tim Rentsch <tr.17687@z991.linuxsc.com>: Aug 23 03:13AM -0700

> is). My skills to guess intentions of other people have been
> always worse than my searching skills ... so I would indeed like
> that intention (if it exists) to be expressed bit more obviously.
 
I second your vote that the properties intended be expressed more
obviously. Also please note that my comment was not making an
assertion but rather was asking a question.
Tim Rentsch <tr.17687@z991.linuxsc.com>: Aug 23 06:31AM -0700

>> elements and nothing else (and in particular, no padding)?
 
> As usual, I'm more concerned about what the committee actually wrote,
> not what it intended to write [...]
 
I'm afraid you have misunderstood the distinction I refer to. It
seems reasonable to assume the words that appear in the standards
reflect what words the respective committees expect and intend to
appear. The question is not what /words/ are intended but what
/meaning/ is intended. A given sequence of words and sentences
doesn't always convey a single meaning, nor necessarily the same
meaning to different readers. The question of what meaning is
intended is paramount.
Tim Rentsch <tr.17687@z991.linuxsc.com>: Aug 23 03:01AM -0700


> basic type safety? Nobody who was concerned with type safety
> would ever have introduced a bool type silently convertible
> to/from int.
 
Converting a boolean value to an integer value, or vice versa, is
perfectly type safe. One might consider it desirable, or not,
for a language to allow such conversions non-explicitly in some
situations, but there is no question that such conversions (as
C++ defines the respective value transformations) are type safe.
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: Aug 23 02:01AM -0700

On 8/21/2020 10:13 PM, Mr Flibble wrote:
> Jesus: "That's the man that murdered you and your family while you were
> sleeping. He repented and asked for forgiveness. Now he's here in
> paradise, with us. Go say hello."
[...]
 
What about something along the lines of:
 
Jesus: "That's the man in Hell. He is locked up, you never have to worry
about it ever again."
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: Aug 23 02:09AM -0700

On 8/23/2020 2:01 AM, Chris M. Thomasson wrote:
 
> What about something along the lines of:
 
> Jesus: "That's the man in Hell. He is locked up, you never have to worry
> about it ever again."
 
Jesus: "The bad man is being exposed to really evil beings, more evil
than it! Hell is terrible. Good thing you are a nice person Timmy.
Welcome to Heaven! By the way, your family wants to greet you!"
Brian Wood <woodbrian77@gmail.com>: Aug 22 09:59PM -0700

On Tuesday, June 16, 2020 at 2:16:51 PM UTC-5, Cholo Lennon wrote:
> should use "the state where police kill non-white people" instead of
> Minnesota, or even better... Killersota... (yes, I have plenty of
> biased/stupid "names")
 
It's like the Spanish flu.
 
"Killersota" isn't completely wrong. Minneapolis
has had more homicides this year than all of last year.
Thankfully, St. Paul isn't as violent/dangerous.
 
 
Brian
Cholo Lennon <chololennon@hotmail.com>: Aug 22 10:49PM -0300

>> have been better.
 
> Your problem is your compiling to web assembly. Serious programs do not
> run in a browser.
 
I am sorry, but I have to say that your bias and ignorance is huge... I
didn't say my program runs in a browser... this blockchain technology
(EOS, https://eos.io/ https://github.com/EOSIO) is built entirely in
C++17... the blockchain nodes are coded in native C++. Each node runs a
WASM virtual machine that executes smart contracts also coded in C++.
And, BTW, there are a lot of good applications running inside a browser,
even an operating system like Linux.
 
--
Cholo Lennon
Bs.As.
ARG
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com.

No comments: