Saturday, September 1, 2018

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

Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Sep 01 04:39PM +0100

On 01/09/2018 15:00, Christian Gollwitzer wrote:
 
> SInce long I keep seeing your satirical posts, but haven't seen a
> religious one from Rick in a while. So now YOU are the one flooding the
> group with BS, please stop it.
 
My posts were in direct response to Hodgin's posts dated 22/08/18 and
30/08/18 (see "[Jesus Loves You] Biblical timeline"). You can now take
that fucking carrot out of your fucking arse.
 
/Flibble
 
--
"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."
bitrex <user@example.net>: Sep 01 12:20PM -0400

On 09/01/2018 11:16 AM, Rick C. Hodgin wrote:
> but after the rapture that blindness will be taken away. Israel
> was bot a nation again until 1948. They didn't have their capital
> back until 1968. God is again preparing Israel to be His people.
 
To be fair Raytheon, General Dynamics, and Lockheed-Martin products
provided at substantial discount did a lot of the work there.
 
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Sep 01 10:10AM -0700

On Saturday, September 1, 2018 at 12:21:03 PM UTC-4, bitrex wrote:
> To be fair Raytheon, General Dynamics, and Lockheed-Martin products
> provided at substantial discount did a lot of the work there.
 
Oil revenues, advanced technology research, and other factors
have also played a part.
 
We are three-fold beings: soul, body, spirit. God uses the natural
to handle those things we are able to do physically. He handles
the supernatural things we cannot do physically. You can see
this in the administration of the fishes and loaves, and in the
resurrection of Lazarus.
 
For all things we are able to do, God calls us to do. Where we
can't, He does. With the fishes and loaves, we brought the fish
and loaves, and we distributed the food to the thousands. God
gave the miracle of multiplying the source.
 
With Lazarus, we rolled the stone away and were called to remove
his grave clothes and tend to him after he was resurrected. Jesus
handled the raising from the dead.
 
Many things in scripture are like this. Peter and his release
from prison, however, shows supernatural intervention to set free
that which was bound.
 
Israel will be supernaturally protected when attacked. And in
the Six Days War, Egyptian soldiers reported seeing large angelic
armies in defense of Israel. They laid down arms because of it.
 
--
Rick C. Hodgin
David Brown <david.brown@hesbynett.no>: Sep 01 08:16PM +0200

On 01/09/18 09:33, bitrex wrote:
 
> comes around asking about it I'm gonna just play dumb. Like with
> Jehovah's Witnesses I'll just pretend I only speak German until they
> give up.
 
The trick with Jehovah's Witnesses is to invite them in. Watch how it
confuses them - it is such an unlikely scenario that it is not part of
their training, and they don't know how to handle it.
Melzzzzz <Melzzzzz@zzzzz.com>: Sep 01 06:24PM


> The trick with Jehovah's Witnesses is to invite them in. Watch how it
> confuses them - it is such an unlikely scenario that it is not part of
> their training, and they don't know how to handle it.
 
When two Jehovas aproached my wife and me: they say: "We offer eternal
life".
My wife: "I don't want to live forever" ;)
That confused them ;)
 
 
--
press any key to continue or any other to quit...
Christian Gollwitzer <auriocus@gmx.de>: Sep 01 11:35PM +0200

Am 01.09.18 um 17:39 schrieb Mr Flibble:
>> the group with BS, please stop it.
 
> My posts were in direct response to Hodgin's posts dated 22/08/18 and
> 30/08/18 (see "[Jesus Loves You] Biblical timeline").
 
which were thankfully ignored by anybody else. Your post started a long
thread again. Your first ones were funny, but now the joke's getting old.
 
Christian
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Sep 01 11:30PM +0100

On 01/09/2018 22:35, Christian Gollwitzer wrote:
>> 30/08/18 (see "[Jesus Loves You] Biblical timeline").
 
> which were thankfully ignored by anybody else. Your post started a long
> thread again. Your first ones were funny, but now the joke's getting old.
 
Joke's getting old? Comedians often use old material. Either way you get
what you fucking pay for mate.
 
/Flibble
 
--
"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>: Sep 01 06:57PM +0200

On 01.09.2018 17:31, Stefan Ram wrote:
 
> I already found »struct alternating_tuple« at
 
> www.cplusplus.com/forum/general/135558/
 
> which might go somewhat in the direction intended.
 
#include <stddef.h> // size_t
#include <tuple> // std::(tie, tuple)
#include <utility> // std::make_index_sequence
 
namespace my
{
//using std::forward_as_tuple;
using std::make_index_sequence;
using std::tie;
using std::tuple;
 
namespace impl
{
using std::get;
using std::index_sequence;
 
template< class Func, class Argsref_tuple, size_t... Indices >
void f(
const Func& func,
const Argsref_tuple& args,
index_sequence<Indices...>
)
{ func( get<1 + 2*Indices>( args )... ); }
}
 
template< class Func, class... Args >
void f( const Func& func, Args&&... args )
{
impl::f(
func,
//forward_as_tuple<Args...>( args... ),
std::tuple<Args&&...>( std::forward<Args>( args )... ),
make_index_sequence<sizeof...(args)/2>()
);
}
} // namespace my
 
#include <stdio.h>
using Int = const int;
 
void g( Int a, Int b, Int c )
{
printf( "%d %d %d\n", a, b, c );
}
 
auto main()
-> int
{ using my::f; f( g, 1, 2, 3, 4, 5, 6 ); }
 
 
Cheers!,
 
- Alf
Juha Nieminen <nospam@thanks.invalid>: Sep 01 05:55PM

> #include <stddef.h>
> #include <stdio.h>
 
Are you serious?
 
> using std::tuple;
> using std::get;
> using std::index_sequence;
 
You wrote 102 characters, and 5 extra lines in total, in order to
save writing three instances of "std::" later. Thus you "saved"
a whopping -87 characters, without making the code any easier to
read or understand (but, arguably, the exact opposite):
 
> index_sequence<Indices...>
> { func( get<1 + 2*Indices>( args )... ); }
> make_index_sequence<sizeof...(args)/2>()
 
And then you aren't even consistent with it:
 
> std::tuple<Args&&...>( std::forward<Args>( args )... ),
 
I have a small suggestion. I know this is completely crazy, but...
How about you don't use the 'using' keyword for this purpose at all?
I know, completely crazy, but just think about it. I doubt that anybody
would get confused if the lines above had been:
 
std::index_sequence<Indices...>
{ func( std::get<1 + 2*Indices>( args )... ); }
std::make_index_sequence<sizeof...(args)/2>()
Jorgen Grahn <grahn+nntp@snipabacken.se>: Sep 01 06:33PM

On Sat, 2018-09-01, Juha Nieminen wrote:
> save writing three instances of "std::" later. Thus you "saved"
> a whopping -87 characters, without making the code any easier to
> read or understand (but, arguably, the exact opposite):
 
+1 (except for the sarcasm, which IMO isn't helpful)
 
/Jorgen
 
--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Sep 01 10:06PM +0200

On 01.09.2018 19:55, Juha Nieminen wrote:
>> #include <stddef.h>
>> #include <stdio.h>
 
> Are you serious?
 
Apparently it helped Stefan.
 
 
> save writing three instances of "std::" later. Thus you "saved"
> a whopping -87 characters, without making the code any easier to
> read or understand (but, arguably, the exact opposite):
 
In my view it's idiotic to focus on numbers of characters.
 
Just my 2 øre.
 
 
Cheers & hth.,
 
- Alf
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Sep 01 11:27PM +0100

On 01/09/2018 21:06, Alf P. Steinbach wrote:
>> read or understand (but, arguably, the exact opposite):
 
> In my view it's idiotic to focus on numbers of characters.
 
> Just my 2 øre.
 
I am sorry Alf but many members of the group agree that your coding style
is pathological in nature.
 
/Flibble
 
--
"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."
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Sep 01 11:25PM +0100

Entity archetype registration and entity creation is a breeze when using
neoGFX's ECS:
 
 
namespace archetypes
{
const ng::game::entity_archetype spaceship
{
neolib::uuid{ 0x26730030, 0xa999, 0x4d99, 0xa7ad,{ 0x80, 0x89, 0x69,
0x23, 0x95, 0xf9 } },
"Spaceship",
{ ng::game::rigid_body::meta::id(), ng::game::box_collider::meta::id() }
};
 
const ng::game::entity_archetype asteroid
{
neolib::uuid{ 0x8283650f, 0x6e59, 0x4f0f, 0x8ae0, { 0x1d, 0x99, 0xeb,
0xf2, 0x49, 0xe0 } },
"Asteroid",
{ ng::game::rigid_body::meta::id(), ng::game::box_collider::meta::id() }
};
}
 
void create_game(ng::i_layout& aLayout)
{
auto& canvas = aLayout.add(std::make_shared<ng::game::ecs_canvas>());
auto& ecs = canvas.ecs();
canvas.set_font(ng::font(canvas.font(), ng::font::Bold, 28));
canvas.set_background_colour(ng::colour::Black);
ecs.register_archetype(archetypes::spaceship);
ecs.register_archetype(archetypes::asteroid);
auto spaceship = ecs.create_entity(archetypes::spaceship.id(),
ng::game::rigid_body{ ng::vec3{ 400.0, 18.0, 0.0 }, 1.0 });
neolib::basic_random<double> prng;
for (int i = 0; i < 1000; ++i)
auto asteroid = ecs.create_entity(archetypes::asteroid.id(),
ng::game::rigid_body{ ng::vec3{ prng(1000.0), prng(1000.0), 0.0 }, 1.0 });
}
 
That is all.
 
Message ends.
 
/Flibble
 
--
"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."
David Brown <david.brown@hesbynett.no>: Sep 01 08:13PM +0200

On 31/08/18 21:29, Chris Vine wrote:
> the things in C99 that do not form part of valid C++. The proposition
> of your respondent that "[VLAs] is pretty much the only real issue
> preventing C++ being a proper superset of C" is weird.
 
Agreed.
 
> restrict qualifier which are not in C++, C's unions behave differently
> and its character literals are of different size. I am sure there are
> lots of other incompatibilities as well.
 
Some of these are less incompatible than the might seem. C has
<stdbool.h> that gives you "bool", "true" and "false" that can be used
in almost the same way as C++'s "bool" type. C11's _Static_assert is
the same as C++'s static_assert in all but details of the name. Many
compilers (including gcc) have a "__restrict" or "__restrict__" in C++
mode, and support compound literals. With the right standard headers in
each language, you can have a subset of atomic uses that work in C11 and
in C++11.
 
However, there can be small or subtle differences in the details here,
which you might need to be careful about. And as I noted elsewhere,
designated initialisers seems to be the most important difference in
practice for many people. (It is coming to C++20, I believe.)
 
> deliberately designed to be both valid C and valid C++. Headers are
> different. Many C libraries aim to be usable in C++ and their headers
> are in the common subset between C89/90 and C++.
 
I gave two other reasons in another post. But I agree that headers are
the most important overlap, and it is rarely difficult to make C headers
that are C++ compatible.
ram@zedat.fu-berlin.de (Stefan Ram): Sep 01 03:31PM

Can anyone here write an implementation of f so that
 
f( g, 1, 2, 3, 4, 5, 6 )
 
or
 
f( g, 1, 2, 3, 4, 5, 6, 7 )
 
will call
 
g( 2, 4, 6 )
 
, e.g., using every other argument with zero runtime
overhead, e.g., using constexpr or templates.
 
One can write f to get the parameters in a parameter
pack and then possibly would need to write recursive
partial specializations so as to unpack the parameter
pack while building a new parameter pack with every
other argument. (That last thing, building that new
parameter pack and then using it for the call is what
I have not yet learned to do!).
 
If there would be an answer, I would then use it in
an ongoing discussion in comp.lang.misc.
 
I already found »struct alternating_tuple« at
 
www.cplusplus.com/forum/general/135558/
 
which might go somewhat in the direction intended.
ram@zedat.fu-berlin.de (Stefan Ram): Sep 01 05:37PM

>Cheers!,
 
Thank you!
 
I have reduced the size of your code somewhat, while I am
aware that I have also reduced it's quality, but I wanted
it to be short (see appendix below).
 
I modified the function g to return the sum of it's arguments
and got what I wanted to get, i.e., in the compilation of »main«:
 
movl $12, %eax
 
$12 being the sum of 2+4+6 from the call
 
return f( g, 1, 2, 3, 4, 5, 6 )
 
, so as to show off the zero-overhead abstraction.
 
appendix:
 
main.cpp
 
#include <cstddef> /* size_t */
#include <cstdio>
#include <tuple> /* std::(tie, tuple) */
#include <utility> /* ::std::make_index_sequence */
 
template< class Func, class Argsref_tuple, size_t... Indices >
auto helper
( const Func& func,
const Argsref_tuple & args,
::std::index_sequence<Indices...> )
{ return func( ::std::get<1 + 2*Indices>( args )... ); }
 
template< class Func, class... Args >
auto f( const Func& func, Args&&... args )
{ return helper ( func,
::std::tuple< Args && ... >( ::std::forward< Args >( args )... ),
::std::make_index_sequence< sizeof ...( args )/2 >() ); }
 
static int g( int a, int b, int c ){ return a+b+c; }
 
int main(){ return f( g, 1, 2, 3, 4, 5, 6 ); }
 
Yes, again, I know that the quality of your code is
higher than the edited version above. Thanks, again!
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: