Sunday, January 5, 2020

Digest for comp.lang.c++@googlegroups.com - 16 updates in 6 topics

Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Jan 05 08:53PM

Hi,
 
I find the name of std::bless and the subsequent concept of "blessing" things in C++ as offensive to both my
beliefs (as I am a militant atheist and anti-theist) and to the concept of keeping religion out of the
technical/scientific/engineering arena (similar to the concept of separation of church and state).
 
I am assuming that this is just a place holder name and that the C++ Committee hasn't been overrun with god bothering fucktards.
 
/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," Byrne 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."
"Öö Tiib" <ootiib@hot.ee>: Jan 05 03:00PM -0800

On Sunday, 5 January 2020 22:53:49 UTC+2, Mr Flibble wrote:
 
> I find the name of std::bless and the subsequent concept of "blessing" things in C++ as offensive to both my
> beliefs (as I am a militant atheist and anti-theist) and to the concept of keeping religion out of the
> technical/scientific/engineering arena (similar to the concept of separation of church and state).
 
Uhh. Calm down, what is that std::bless even supposed to be? Never heard
of it.
 
 
> I am assuming that this is just a place holder name and that the C++ Committee hasn't been overrun with god bothering fucktards.
 
And also in your proposals you can likely be more constructive.
Propose alternatives std::endow, std::favor, std::preserve and
avoid mentioning fucktards. ;)
Bonita Montero <Bonita.Montero@gmail.com>: Jan 05 03:01PM +0100


>> That's not true. You're a liar.
 
> That's a nasty thing to say. If I thought you were a serious
> contributer, I'd be offended.
 
Try the fixed code. The fixed code gives this with gcc on my computer:
 
size: 2 bs: 0.7988 s: 1.2735
size: 3 bs: 0.9466 s: 1.5443
size: 4 bs: 1.2005 s: 1.6128
size: 5 bs: 1.5233 s: 1.9473
size: 6 bs: 2.353 s: 1.9982 ---
size: 7 bs: 2.2377 s: 2.365
size: 8 bs: 4.0274 s: 2.727
size: 9 bs: 3.4135 s: 3.2835
size: 10 bs: 4.171 s: 3.269
size: 11 bs: 4.7766 s: 3.7635
size: 12 bs: 5.6038 s: 4.1902
size: 13 bs: 7.9656 s: 4.0113
size: 14 bs: 8.9014 s: 4.5925
size: 15 bs: 9.9181 s: 4.7311
size: 16 bs: 11.1119 s: 4.9711
size: 17 bs: 12.4162 s: 6.0172
size: 18 bs: 14.4748 s: 6.85
size: 19 bs: 15.8686 s: 7.1291
size: 20 bs: 20.8648 s: 7.2139
 
Above 5 elements quicksort ist faster.
Melzzzzz <Melzzzzz@zzzzz.com>: Jan 05 03:16PM

> just reporting on the output.
 
> Third, the OP was not just about bubble sort. To get a sound answer
> from measurements, the best simple sort, insertion sort, should be used.
 
I use quicksort then insertion sort when partition falls down bellow 15
elements...
I think this is common knowledge.
 
--
press any key to continue or any other to quit...
U ničemu ja ne uživam kao u svom statusu INVALIDA -- Zli Zec
Svi smo svedoci - oko 3 godine intenzivne propagande je dovoljno da jedan narod poludi -- Zli Zec
Na divljem zapadu i nije bilo tako puno nasilja, upravo zato jer su svi
bili naoruzani. -- Mladen Gogala
Soviet_Mario <SovietMario@CCCP.MIR>: Jan 05 09:13PM +0100

On 05/01/20 05:03, Bonita Montero wrote:
> be billions of such sorts. And I measured that bubblesort is
> even
> slower for a few elements; that's not apparent.
 
 
If I did understand right, Ben was saying that very short
sorting could be repeated thousands of times (not meaning
sorting thousands of items, but some tens of items in
thousand occasions : giving a multiplier of advantage or
disadvantage).
 
 
Anyway : to sum up this thread.
 
I've found the stable_sort in the header algorithm.
I did not fully understand its internals (a template of too
much parameters obscure to me), so I have decided to recode
the 10 lines long example Gnome Sort (optimized version)
from Wikipedia.
 
 
Moreover I have to adapt it to sorting rows / columns of a
rectangular matrix, where the key-field is a parameter and
whole columns/rows have to be moved, not just the key-field
 
As I did not well understand the standard algorithm version,
I gave up with it in this more customized sorting.
 
Tnx to all
 
--
1) Resistere, resistere, resistere.
2) Se tutti pagano le tasse, le tasse le pagano tutti
Soviet_Mario - (aka Gatto_Vizzato)
Ben Bacarisse <ben.usenet@bsb.me.uk>: Jan 05 10:26PM


>> That's a nasty thing to say. If I thought you were a serious
>> contributer, I'd be offended.
 
> Try the fixed code. The fixed code gives this with gcc on my computer:
 
No apology for accusing me of lying I see.
 
The fixed code does not alter what I said: the simple sort is faster for
all your test sizes for some data sets -- specifically when the data are
already sorted. The factor is now smaller (no longer always greater
than 2) but still between 1.5 and 2.
 
--
Ben.
Manfred <noname@add.invalid>: Jan 05 10:31PM +0100

On 1/4/2020 11:34 PM, Frederick Gotham wrote:
> cout << elem << endl;
> }
 
> Now I can get back to testing my new allocator.
 
The following satisfies the rebind requirement, although I do not know
how this may play in a more elaborate context:
 
template<typename T, std::size_t capacity>
class StaticAllocator {
public:
typedef T value_type;
 
protected:
 
static T buf[capacity];
 
public:
 
template<typename U>
struct rebind
{
typedef StaticAllocator<U, capacity> other;
};
 
T *allocate(std::size_t const n)
{
if (n > capacity)
throw std::bad_alloc();
 
return buf;
}
 
void deallocate(T *, std::size_t)
{
/* Do Nothing */
}
};
Ralf Goertz <me@myprovider.invalid>: Jan 05 04:06PM +0100

Am Sat, 4 Jan 2020 21:46:28 -0000 (UTC)
> Do you want (2,1) to be less than (1,2) ? if you want to define a
> lexicographical order on (i,j), the comparison should be
 
> return i<r.i || (i==r.i && j<r.j);
 
Yeah, I know. I did get it wrong but I only defined the operator in
order to be able to use Foo with the set. I was puzzled by the compile
errors with array. I thought that the fact that array is templated could
be the reason. So I tried the non-templated Foo and the errors were
gone. I would never have guessed that the namespace was the problem.
Jorgen Grahn <grahn+nntp@snipabacken.se>: Jan 05 06:24PM

On Sun, 2020-01-05, Ralf Goertz wrote:
>> lexicographical order on (i,j), the comparison should be
 
>> return i<r.i || (i==r.i && j<r.j);
 
> Yeah, I know.
 
I don't know why, but I feel safer defining it like this:
 
bool operator<(const struct Foo &r) const {
if (i==r.i) return j < r.j;
return i < r.i;
}
 
Another option would be std::make_pair, and comparing the pairs.
 
/Jorgen
 
--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
"Öö Tiib" <ootiib@hot.ee>: Jan 05 10:56AM -0800

On Sunday, 5 January 2020 20:24:38 UTC+2, Jorgen Grahn wrote:
> return i < r.i;
> }
 
> Another option would be std::make_pair, and comparing the pairs.
 
Funny. I checked that most usual in my code is that pattern:
 
return (l.a != r.a) ? l.a < r.a
: (l.b != r.b) ? l.b < r.b
: (l.c != r.c) ? l.c < r.c
: (l.d != r.d) ? l.d < r.d
: l.e < r.e;
Jorgen Grahn <grahn+nntp@snipabacken.se>: Jan 05 07:55PM

On Sun, 2020-01-05, Öö Tiib wrote:
> : (l.c != r.c) ? l.c < r.c
> : (l.d != r.d) ? l.d < r.d
> : l.e < r.e;
 
"The first pair that's different gets to decide." Makes sense!
 
/Jorgen
 
--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
Robert Wessel <robertwessel2@yahoo.com>: Jan 05 12:31PM -0600


>Complex has a very niche use case so I can understand that, but VLAs are very
>useful if just writing plain C and can't be hard to implement so I don't
>understand the decision to make them optional.
 
 
If so, only because most folks who needed complex numbers moved on to
C++ (or rolled their own support in C long ago, and have not replaced
that).
 
And don't be so quick to condemn a facility *you* don't happen to use
as "niche". In my experience there is *far* more use of complex
numbers in C than VLAs. Admittedly only part of that is done with the
native C complex type.
 
On the other hand, VLAs present considerable implementation
difficulties on some small systems, and present a number of issues
with regards to stack growth on all implementations that make people
wary of them.
 
Complex support does require some compiler support, but it's just
another data type. The actual implementations of the basic functions
is pretty trivial, and for small systems can be dumped in a library
where it won't get linked if it's not used, so it has no impact on
small systems.
David Brown <david.brown@hesbynett.no>: Jan 05 08:11PM +0100

On 05/01/2020 19:31, Robert Wessel wrote:
> as "niche". In my experience there is *far* more use of complex
> numbers in C than VLAs. Admittedly only part of that is done with the
> native C complex type.
 
I think it is extremely difficult to guess which features are more or
less used, and any attempts will be very biased based on the area of
experience of the guesser. With that proviso, I'd be surprised if
complex types really were used more than VLAs.
 
> difficulties on some small systems, and present a number of issues
> with regards to stack growth on all implementations that make people
> wary of them.
 
I disagree. I don't see that VLA implementation would be particularly
difficult (in small systems or otherwise). And while it is absolutely
correct that you need to be careful about stack use before using them,
you don't need more care than you should be taking for any other kind of
non-variable local array, or for any other kind of memory allocation.
 
> is pretty trivial, and for small systems can be dumped in a library
> where it won't get linked if it's not used, so it has no impact on
> small systems.
 
I don't imagine C's complex number support would be that hard to
implement either.
 
I really don't understand why these were made optional in C11. Who is
going to make a compiler that is C11 compliant but not C99 compliant?
Who is going to be capable of making a C11 compiler but find supporting
VLA's or complex numbers a major issue?
 
I doubt if their lack will cause a big problem for many people - but
sometimes they can be convenient.
"Öö Tiib" <ootiib@hot.ee>: Jan 05 11:22AM -0800

On Sunday, 5 January 2020 21:11:28 UTC+2, David Brown wrote:
> going to make a compiler that is C11 compliant but not C99 compliant?
> Who is going to be capable of making a C11 compiler but find supporting
> VLA's or complex numbers a major issue?
 
Yes, _Generic, <threads.h> and <stdatomic.h> sound like work,
while VLA's and complex numbers sound like syntax sugar.
boltar@nowhere.org: Jan 05 04:29PM

On Sat, 4 Jan 2020 20:50:14 +0000
>> same time?
 
>Yes I did: if you don't believe me then you simply have to look at the source
>code as it is on github. Now kindly fuck off.
 
No idea where it is on github and I have better things to do that wade through
the convoluted mess you'll have written. Plus that tells me nothing about its
speed compared to other parsers.
Jorgen Grahn <grahn+nntp@snipabacken.se>: Jan 05 06:07PM

On Sat, 2020-01-04, Öö Tiib wrote:
> semantic analysis of text) to computer science where it now means
> any kind of deserializations? I am last from whom to ask extent of
> modern English anyway.
 
I'm not an authority either.
 
I always assumed parsing meant reading any kind of data, deciding if
it matches the parser's language, and if it does, offering the
"pieces" in a helpful way to the next step of processing.
 
E.g. yacc is a parser generator, but in my mind so is scanf().
 
(And as background: I know for sure I was taught in computer science
that "language" is anything with a syntax and (I suppose) semantics.
It doesn't have to be Turing-complete or anything.)
 
> for raster picture). Then I use json for everything for what I don't
> have such format. That might result with lot of files that I prefer
> to zip into one file in Open Document Format style.
 
We probably solve different kinds of problems; I tend to do things
which fit in Unix pipelines.
 
/Jorgen
 
--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
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: