Wednesday, July 17, 2019

Digest for comp.lang.c++@googlegroups.com - 9 updates in 4 topics

"Öö Tiib" <ootiib@hot.ee>: Jul 17 12:52PM -0700

On Wednesday, 17 July 2019 16:49:35 UTC+3, Soviet_Mario wrote:
> time, both, separators ? named day / month ?)
> It is the kind of piece of code one would never want to
> write by hand.
 
There are 6500 human languages and date is possible to write
down in large number of ways in each of those so you should
perhaps drop C++ and take AI training courses.
In C++ we set either strongly fixed textual format or use GUI
"date picker" that provides binary format right away.
Keith Thompson <kst-u@mib.org>: Jul 17 01:28PM -0700

> perhaps drop C++ and take AI training courses.
> In C++ we set either strongly fixed textual format or use GUI
> "date picker" that provides binary format right away.
 
Or we could use a parser that accepts a reasonable variety of formats.
 
For example, Perl has a "Date::Parse" module that does this.
I'd be surprised if there weren't something similar in C++.
 
Supporting *all* date forms is admittedly not possible. Some inputs
like "7/4/2019" are ambiguous.
 
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */
scott@slp53.sl.home (Scott Lurndal): Jul 17 08:34PM

>> time, both, separators ? named day / month ?)
>> It is the kind of piece of code one would never want to
>> write by hand.
 
Yes, if only it were part of a standard library. Oh, it is:
 
http://pubs.opengroup.org/onlinepubs/9699919799/functions/strptime.html
Soviet_Mario <SovietMario@CCCP.MIR>: Jul 17 11:52PM +0200

On 17/07/19 22:28, Keith Thompson wrote:
>> In C++ we set either strongly fixed textual format or use GUI
>> "date picker" that provides binary format right away.
 
> Or we could use a parser that accepts a reasonable variety of formats.
 
+1
 
many years ago I started to evaluate BOOST ... but was
really huge and didn't get to know it it has "fine grain"
enabling one to pick up just a couple of things needed.
 
BOOST had some parsin functions ... but it scared me then
(and it scares me now even more)
 
 
> For example, Perl has a "Date::Parse" module that does this.
> I'd be surprised if there weren't something similar in C++.
 
normally here on linux I use gambas (a basic dialect).
It has some string and built in DATE/TIME functions.
I've read a program can be made "a demon" (a TSR) so as a
last resort I could willy nilly write a small piece of
string-to-struct program to keep resident.
But I'm far from happy to try an inter-process data exchange.
 
 
> Supporting *all* date forms is admittedly not possible. Some inputs
> like "7/4/2019" are ambiguous.
 
also I'm beginning to discover if C++ supports RegEx and in
which form. (gambas supports them and also perl-like RegEx)
To discover the format used in a date would be much easier
by RegEx patterns.
 
 
For Oo Tiib (sorry for the umlauth) : I have little control
over input formats, I'm collecting some user-filled online
forms and have to mangle them. Recent data are pre-filtered
using google modules/sheets and RegEx, but older data were
rather irregular.
 
 
--
1) Resistere, resistere, resistere.
2) Se tutti pagano le tasse, le tasse le pagano tutti
Soviet_Mario - (aka Gatto_Vizzato)
Soviet_Mario <SovietMario@CCCP.MIR>: Jul 17 11:55PM +0200

On 17/07/19 22:34, Scott Lurndal wrote:
>>> write by hand.
 
> Yes, if only it were part of a standard library. Oh, it is:
 
> http://pubs.opengroup.org/onlinepubs/9699919799/functions/strptime.html
 
quote myself
 
<<
...
ah, meanwhile I did found sth here
https://pubs.opengroup.org/onlinepubs/009695399/functions/strptime.html
 
which is still not satisfactory, as this function require
the FORMAT of the textual data be known in advance, a demand
that cannot be fulfilled ...
 
I'm gonna read your suggestions. Ciao
 
as I said, I don't know the format in advance and above all
it's not taken for granted at all that every data will have
the same homogeneous format.
 
I need a parsing function aware of the human-written date-time.
But I'll also explore RegEx patterns to define narrower
contexts ...
 
--
1) Resistere, resistere, resistere.
2) Se tutti pagano le tasse, le tasse le pagano tutti
Soviet_Mario - (aka Gatto_Vizzato)
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Jul 17 10:15PM +0100

On 17/07/2019 16:01, Alf P. Steinbach wrote:
 
> The two main problems with this function are:
 
> * Passing `value` by value may incur severe copying inefficiency.
> * The tail recursion may easily consume all stack space and yield UB.
 
The whole point of using tail recursion is that is doesn't use up stack
space, silly boy.
 
/Flibble
 
--
"Snakes didn't evolve, instead talking snakes with legs changed into
snakes." - Rick C. Hodgin
 
"You won't burn in hell. But be nice anyway." – Ricky Gervais
 
"I see Atheists are fighting and killing each other again, over who
doesn't believe in any God the most. Oh, no..wait.. that never happens." –
Ricky Gervais
 
"Suppose it's all true, and you walk up to the pearly gates, and are
confronted by God," Bryne asked on his show The Meaning of Life. "What
will Stephen Fry say to him, her, or it?"
"I'd say, bone cancer in children? What's that about?" Fry replied.
"How dare you? How dare you create a world to which there is such misery
that is not our fault. It's not right, it's utterly, utterly evil."
"Why should I respect a capricious, mean-minded, stupid God who creates a
world that is so full of injustice and pain. That's what I would say."
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Jul 17 11:29PM +0200

On 17.07.2019 23:15, Mr Flibble wrote:
>> * The tail recursion may easily consume all stack space and yield UB.
 
> The whole point of using tail recursion is that is doesn't use up stack
> space, silly boy.
 
Unfortunately the C++ standard gives you no such guarantee.
 
But a particular compiler may.
 
It's difficult to predict because it may not be documented for the
compiler, and the compiler may optimize or not based on criteria that
only make sense internally (e.g., is the return type floating point?).
 
 
Cheers!,
 
- Alf
"Öö Tiib" <ootiib@hot.ee>: Jul 17 01:08PM -0700

On Wednesday, 17 July 2019 22:34:25 UTC+3, Horizon68 wrote:
> On 7/17/2019 12:17 PM, Bonita Montero wrote:
> > Can you please stop your manic off-topic postings here?
 
> Don't worry, i am posting just very few posts here.
 
Post your very few posts in your comp.programming ... if
anyone wants to read your posts then all know where it
is.
Szyk Cech <szykcech@spoko.pl>: Jul 17 09:38PM +0200

M$ can't explore C++ smart pointers?!?
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: