Monday, December 26, 2016

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

Gareth Owen <gwowen@gmail.com>: Dec 26 06:28PM

>> making an assumption that you are a follower of an Abrahamic religion
>> (a good bet usually for someone with such an Anglo-Saxon name).
 
> Except that both 'Gareth' and 'Owen' come from Welsh.
 
Also, I'm not even slightly religious. I am a militant agnostic.
woodbrian77@gmail.com: Dec 26 11:13AM -0800

On Friday, December 23, 2016 at 4:03:31 PM UTC-6, Mr Flibble wrote:
 
> > I gotta lot of problems with you people.
 
> You people? Your god doesn't exist mate; try a different religion which
> doesn't rely on evolution being false.
 
Oxford Theoretical physicist Ard Louis explains his own view of how
science and faith relate to each other – one that recognises the fact
that faith influences the whole of life. Ard gives examples to show
how this affects the way he conducts his work and relationships with
his colleagues.
 
http://www.dailyedify.com/science-and-faith-adversaries-or-complementary-partnership/
 
C.S. Lewis believed in the G-d of the Bible and evolution. Ben
Shapiro at dailywire.com has somewhat similar beliefs.
 
 
 
Brian
Ebenezer Enterprises - "There are rules behind the rules
and a unity that is deeper than uniformity." C.S. Lewis
 
http://webEbenezer.net
Mr Flibble <flibble@i42.co.uk>: Dec 26 07:18PM

On 26/12/2016 18:28, Gareth Owen wrote:
>>> (a good bet usually for someone with such an Anglo-Saxon name).
 
>> Except that both 'Gareth' and 'Owen' come from Welsh.
 
> Also, I'm not even slightly religious. I am a militant agnostic.
 
I take it you are also atheist?
 
/Flibble
woodbrian77@gmail.com: Dec 26 09:46AM -0800

On Wednesday, November 9, 2016 at 1:23:40 PM UTC-6, Rick C. Hodgin wrote:
> sync with a constant online or sporadic online / offline connection. It
> has issue tracking, annotation on code. It's free for all public
> repositories, and is fee-based for private ones.
 
Now I've created a repo on Github also:
https://github.com/woodbrian/onwards
 
One thing I like about Github is they make it easy to add
a license to your project. I chose the BSD 2-clause license.
I haven't really decided though whether to stick to bitbucket
or swith to github. My website is still pointing at the
bitbucket repo.
 
 
Brian
Ebenezer Enterprises
http://webEbenezer.net
"Poraty the poltroon" <LOL_IMA_POSTER@gmail.com>: Dec 25 02:46PM -0800

Looks like the ideal guide for fucktards such as yourself.
woodbrian77@gmail.com: Dec 25 04:47PM -0800

On Sunday, December 25, 2016 at 4:47:13 PM UTC-6, Poraty the poltroon wrote:
 
Please don't swear here.
 
 
Brian
Ebenezer Enterprises - I heard that this is the first time
in 100 years that Chanukah and Christmas have lined up like this.
 
http://webEbenezer.net
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Dec 25 05:04PM -0800

On Sunday, December 25, 2016 at 4:40:07 PM UTC-5, Jeff-Relf.Me wrote:
> My C++ Coding Style: http://Jeff-Relf.Me/cStyle.HTM
 
You incorporate a great many things I would say are ill-advised when
considering software as part of a long-term offering, one which will
require maintenance and tweaking over time. Your stated goals and
purposes will require more work for the maintainers.
 
FWIW, as I was reading it, I honestly thought you were trying to do
the exact opposite of what was right in many areas. But, I checked
the calendar and it's not April 1 ... so I'm at a loss.
 
Best regards,
Rick C. Hodgin
Mr Flibble <flibble@i42.co.uk>: Dec 26 01:56AM

> On Sunday, December 25, 2016 at 4:47:13 PM UTC-6, Poraty the poltroon wrote:
 
> Please don't swear here.
 
"That's 28 fucks. Including that one 29. Ah fuck it make it 30." -- Paul
Calf
 
https://www.youtube.com/watch?v=42UCpOzTbNU
 
/Flibble
Ecclesiastic Sakan ibn Abdallah Mahmoud <bemused.blonde.immoral-girl@alt.flame.uninspirational-lady-of-no-virtue>: Dec 26 01:55AM


> My C++ Coding Style: http://Jeff-Relf.Me/cStyle.HTM
 
Also known as "How Not to Write Code".
 
--
It ain't often that a man's reputation outlasts his money; Josh
Billings
Jerry Stuckle <jstucklex@attglobal.net>: Dec 25 09:55PM -0500

> Ebenezer Enterprises - I heard that this is the first time
> in 100 years that Chanukah and Christmas have lined up like this.
 
> http://webEbenezer.net
 
And you heard wrong. But that's not unusual. You never are right about
anything.
 
--
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex@attglobal.net
==================
Louis Krupp <lkrupp@nospam.pssw.com.invalid>: Dec 26 02:41AM -0700


>My C++ Coding Style: http://Jeff-Relf.Me/cStyle.HTM
 
:)
 
Louis
Ruben Safir <mrbrklyn@panix.com>: Dec 26 08:47AM

> bless those that bless the nation which came through Abraham, and He will
> curse those which curse that nation (Genesis 12:3).
 
> No. Christian do not in any way, shape, or form, hate any Jews.
 
No your not my brother. Your sinners theives and crooks and are going
to hell. Only you can save yourslef. Give up your false god right away
or face the hellfire of hell
 
ram@zedat.fu-berlin.de (Stefan Ram): Dec 22 01:38AM

>I have a vector of std::vector<SomeType>. The precise number of vectors
>containing SomeType is unknown at runtime.
 
... is only known as late as runtime.
 
>How best to merge the set into a single std::vector<SomeType> with the
>SomeTypes arranged one after another, i.e. such that the "columns" of
>the first vector are transposed into a single row?
 
#include <initializer_list>
#include <iostream>
#include <ostream>
#include <vector>
#include <iterator>
#include <algorithm>
 
template< class T >
::std::vector< T >flatten
( ::std::vector< ::std::vector< T >> const & s )
{ ::std::vector< T > t;
auto bt = back_inserter( t );
for( auto const & v: s )
copy( begin( v ), end( v ), bt );
return t; }
 
int main()
{ using T = int;
::std::vector< ::std::vector< T >>s { { 1, 2 }, { 3 }};
::std::vector< T >t = flatten( s ); }
 
Additional exercise: Generalize this to the case where the
source vector contains »entries«, each of which at runtime
(polymorphically) can be either a number or a list of
numbers, nested to an arbitrary depth, and then flatten this!
 
Hint:
 
( SETQ FLATTEN
( LAMBDA( X )
( COND
( ( NULLP X ) '() )
( ( ATOMP X ) X )
( T ( APPEND
( COND
( ( ATOMP( CAR X ))( LIST( CAR X )))
( T ( FLATTEN( CAR X ))))
( FLATTEN( CDR X )))))))
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Dec 22 02:09AM +0100

On 22.12.2016 01:33, bitrex wrote:
> vectors containing SomeType is unknown at runtime.
 
> How best to merge the set into a single std::vector<SomeType> with
> the SomeTypes arranged one after another,
 
Define "best".
 
 
> i.e. such that the "columns" of the first vector are transposed into
> a single row?
 
I don't understand this requirement
 
This is simple amortized linear time code to concatenate some vectors:
 
vector<int> a;
vector<int> b;
vector<int> c;
 
// ...
vector<int> all;
for( vector<int>* pv : {&a, &b, &c} )
{
all.insert( all.end(), pv->begin(), pv->end() );
}
 
To optimize this slightly you can `reserve` the requisite capacity for
the `all` vector before the loop.
 
 
Cheers & hth.,
 
- Alf
Marcel Mueller <news.5.maazl@spamgourmet.org>: Dec 21 12:51AM +0100

On 21.12.16 00.43, Mr Flibble wrote:
 
> Even if we don't consider the UB case above one may also consider 'r' to
> be "invalidated" if it stops referring to s[0] and instead refers to
> s2[0] because COW happened.
 
You just pointed out why the Java concept of an immutable String class
and a mutable StringBuilder is superior. I prefer this concept wherever
possible.
 
 
Marcel
Bo Persson <bop@gmb.dk>: Dec 21 05:26PM +0100

On 2016-12-21 08:18, Juha Nieminen wrote:
> I just require vectors to be accessible very efficiently, which
> they are. And the convenience of std::vector over a custom
> implementation is vastly greater.
 
Right!
 
Chandler Carruth can spend time making the program run 1% faster,
because that saves the company millions of dollars on their server farms.
 
For the rest of us "efficient" most often means "getting the app out
*this* year". Not running 1% faster next year.
 
 
Bo Persson
Bonita Montero <Bonita.Montero@gmail.com>: Dec 21 06:02PM +0100

Am 21.12.2016 um 17:26 schrieb Bo Persson:
 
> For the rest of us "efficient" most often means "getting
> the app out *this* year". Not running 1% faster next year.
 
It should be very rare that a company tunes for the last 1%.
Even Twitter and eBay use Java on its servers which hasn't
the repute to be the most efficient language (i.e. the VM).
 
--
http://facebook.com/bonita.montero/
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Dec 21 07:01PM +0100

On 21.12.2016 03:56, Alf P. Steinbach wrote:
> pure library implementation, by detecting the return type via `operator
> auto()` (or in C++11 and earlier `operator T` with `T` a template
> parameter),
 
Sorry I was not thinking there, or in other words, I was momentarily
stupid: one needs a name for the return type in order to discriminate
the cases. So `auto` is out. An old-fashioned template is the only pure
library way as I see, if it works to implement the observable behavior
exactly (or anyway in a proof of concept implementation):
 
> intrinsics and knowledge of the particular concrete compiler behavior,
> e.g. as the standard library's `offsetof` macro necessarily does.
> [snip]
 
 
Cheers!,
 
- Alf
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Dec 20 11:43PM

On 20/12/2016 23:16, Alf P. Steinbach wrote:
> a buffer unsharing, it's unshared precisely because the possibility of a
> reference looms on the horizon – but in spite of being obvious bollocks,
> just a self-contradiction, it's upvoted 86 times.
 
Invalidating references is a problem, consider:
 
std::string s = "foo";
const char& r = s[0];
{
std::string s2 = s; // s now shared
s[0] = "c"; // COW happens
} // s2 destroyed
assert(r == 'c'); // bad UB: r will now refer to garbage
 
Even if we don't consider the UB case above one may also consider 'r' to
be "invalidated" if it stops referring to s[0] and instead refers to
s2[0] because COW happened.
 
/Flibble
Ben Bacarisse <ben.usenet@bsb.me.uk>: Dec 21 08:34PM


>> I look forward to you Stuckling out of that.
 
> "Due to poor pivot choice worst case performance will manifest more
> often and that is quadratic complexity."
 
Is this a sociological claim rather than a technical one? There's no
technical reason why the choice of pivot should be a poor one in a
linked list implementation, but the last time that was pointed out your
reply was simply "Nah", so maybe you do still think you are raising a
technical issue about algorithms.
 
<snip>
--
Ben.
Gareth Owen <gwowen@gmail.com>: Dec 21 11:34PM


>> Not true. Maths isn't a strong point, is it?
 
> This has nothing to do with maths; this is to do with analysing
> algorithmic complexity.
 
*facepalm* Analysing algorithms is a discipline of mathematics.
 
> See Wikipedia above.
 
Nevertheless, if you were capable of doing the mathematics, you'd see
that the average case performance is still O(N log N). The proof that
quicksort is O(N log N) on average is independent of the underlying data
structure. The reason for this is that choosing a sane pivot (median of
nine say) is O(n), and you can do a fixed number of different O(n) at
each recursive step you don't change the algorithmic complexity (but you
might screw up the constants so badly that it runs much slower than
mergesort).
 
The Wikipedia section on "Selection based pivoting" describes a scheme
based on this fact.
 
Note also that proviso in Wikipedia is about *stable* quicksort, and
std::list::sort is *not* required to be stable. Note also, that some
time ago I mentioned that mergesort is often preferred because it is
stable, where quicksort isn't.
 
> /Flibble
 
PS: Your killfile is broken
Paavo Helde <myfirstname@osa.pri.ee>: Dec 21 01:50PM +0200

On 21.12.2016 13:16, Popping mad wrote:
> PIC():beg{&source[0]}, end{&source[99]} , canvas_index
> {canvas}
> {
[...]
> };
[...]
> private:
[...]
> char * canvas_index;
> char * canvas = new char[100];
[...]
 
canvas_index is initialized before canvas, because it is declared before
canvas in the class definition. Thus, it is initialized with garbage.
woodbrian77@gmail.com: Dec 24 05:34PM -0800

> shortly after the two minute mark.
 
> So I'm wondering if this is going to be valid C++ 2017 code:
 
> ::std::unique_ptr<cmw_request> request(localbuf);
 
Or maybe it should be:
 
::std::unique_ptr request(cmw_request(localbuf));
 
or
 
::std::unique_ptr request(::new cmw_request(localbuf));
 
?
 
Those don't compile here either.
::std::unique_ptr request(::new cmw_request(localbuf));
woodbrian77@gmail.com: Dec 24 07:03PM -0800

> support for C++ 2017, but only found support for C++ 2014
> and earlier. Could someone point me to a site that has that?
> Thanks in advance.
 
I checked Compiler Explorer now and it has more up to date
compilers.
 
 
 
Ian Collins <ian-news@hotmail.com>: Dec 25 04:48PM +1300

> Previously I had this line:
> ::std::unique_ptr<cmw_request> request(::new cmw_request(localbuf));
 
I can see some (very week) justification for the superfluous colons
before std, but new?
 
--
Ian
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: