Monday, October 10, 2016

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

Jerry Stuckle <jstucklex@attglobal.net>: Oct 10 05:21PM -0400

On 10/10/2016 3:37 PM, Lynn McGuire wrote:
 
> I am a Christian. Rick is what the Bible calls a false teacher. He
> reads rules and messages into Bible sayings where there is none.
 
> Lynn
 
Lynn, I agree on both counts.
 
--
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex@attglobal.net
==================
woodbrian77@gmail.com: Oct 10 02:45PM -0700

On Monday, October 10, 2016 at 12:24:03 PM UTC-5, red floyd wrote:
 
Even though your name is Red, I hope you won't
leave this group and go to Reddit where sheep
aren't able to safely graze.
 
 
Brian
Ebenezer Enterprises
http://webEbenezer.net
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Oct 10 03:57PM -0700

We read:
 
http://biblehub.com/kjv/1_corinthians/10-24.htm
 
24 Let no man seek his own, but
every man another's wealth.
 
Our goals are to improve other people's lives, to increase their substance,
because our acts of giving are repaid by God in Heaven, and they
endure forever. If we receive payment here, we have our reward in
full.
 
Satan robs us blind by having us seek worldly gain. He wants even
those who are saved to enter eternity bankrupt (figuratively speaking):
 
http://biblehub.com/kjv/matthew/6.htm
 
19 Lay not up for yourselves treasures upon earth, where moth
and rust doth corrupt, and where thieves break through and
steal:
20 But lay up for yourselves treasures in heaven, where neither
moth nor rust doth corrupt, and where thieves do not break
through nor steal:
21 For where your treasure is, there will your heart be also.
 
Best regards,
Rick C. Hodgin
"Chris M. Thomasson" <invalid@invalid.invalid>: Oct 10 04:22PM -0700

On 10/10/2016 2:12 PM, Jerry Stuckle wrote:
 
> Well, let's see. I can spend $100,000 worth of my time writing a great
> program. I can sell 0 copies at $100,000 ea. Or I can sell 20,000
> copies at $10 ea.
 
Damn right.
 
 
> money left over to buy new equipment.
 
> But according to Rick, I can't sell the copies. I can only sell the
> original.
 
AFAICT, I think, in his wacky world of radically intense insanity, God
only allows one to sell a 100,000$ worth at 1 dollar a unit. This is
because you performed a 100,000$ worth of labor. But, according to Rick,
God's right hand man, if you make any money over a 100 grand and keep
the profits for your family's well being, then you are equal to the sins
of hi%ler, because, hey man, sin is sin is sin, ya know?
 
Damn, rick is nuts! And be the way, Rick is promoting God as a hardcore,
communist hive mind dictator, hyper-jealous demented wack job. That
wants his creations to be on their knees, and be happy about it!
legalize+jeeves@mail.xmission.com (Richard): Oct 10 04:43PM

[Please do not mail me a copy of your followup]
 
mark <mark@invalid.invalid> spake the secret code
 
>const compiles. However, it does not result in compile time constant
>value
 
Please defined "compile time constant value" in specific terms.
 
For a simple constant address value I'd find it hard to believe that any
compiler (old or new) wouldn't turn this into a piece of fixed data in
the initialized data segment of the output image. If properly declared
and defined I'd find it hard to believe that many if not most compilers
would inline the value directly.
--
"The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline>
The Computer Graphics Museum <http://computergraphicsmuseum.org>
The Terminals Wiki <http://terminals.classiccmp.org>
Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com>
mark <mark@invalid.invalid>: Oct 10 10:24PM +0200

On 2016-10-10 18:43, Richard wrote:
 
>> >const compiles. However, it does not result in compile time constant
>> >value
> Please defined "compile time constant value" in specific terms.
 
---------------------------------------------------------------
#define REGISTER (*(volatile uint32_t *)0x42424242)
const uintptr_t register_addr = (uintptr_t) &REGISTER;
 
template<uintptr_t ptr> struct S {};
using S42 = S<register_addr>;
---------------------------------------------------------------
error: non-type template argument is not a constant expression
 
---------------------------------------------------------------
constexpr uintptr_t fn(uintptr_t v){ return (v % 128) / 4; }
constexpr size_t pin_number = fn(register_addr);
---------------------------------------------------------------
error: constexpr variable 'pin_number' must be initialized by a constant
expression
 
> the initialized data segment of the output image. If properly declared
> and defined I'd find it hard to believe that many if not most compilers
> would inline the value directly.
 
I'm not concerned about direct usages getting inlined. I'm concerned
about not being able to do template / constexpr metaprogramming.
legalize+jeeves@mail.xmission.com (Richard): Oct 10 08:56PM

[Please do not mail me a copy of your followup]
 
mark <mark@invalid.invalid> spake the secret code
>using S42 = S<register_addr>;
>---------------------------------------------------------------
>error: non-type template argument is not a constant expression
 
Get rid of the C-style cast and the problem becomes obvious.
 
>I'm not concerned about direct usages getting inlined. I'm concerned
>about not being able to do template / constexpr metaprogramming.
 
What template metaprogramming? So far you've only talked about
contexpr functions.
--
"The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline>
The Terminals Wiki <http://terminals-wiki.org>
The Computer Graphics Museum <http://computergraphicsmuseum.org>
Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com>
mark <mark@invalid.invalid>: Oct 11 12:39AM +0200

On 2016-10-10 22:56, Richard wrote:
>> >---------------------------------------------------------------
>> >error: non-type template argument is not a constant expression
> Get rid of the C-style cast and the problem becomes obvious.
 
I know exactly that this is a reinterpret_cast, I have quoted the
standard myself, if you go up a few posts. I know that the standard
doesn't allow it and I'm looking for a workaround.
 
>> >about not being able to do template / constexpr metaprogramming.
> What template metaprogramming? So far you've only talked about
> contexpr functions.
 
I haven't talked about templates, because it's pretty much the same in
terms of restrictions. If its a constexpr value, it can be used as
template parameter (or array bounds or whatever). I have very
specifically said constexpr and not const.
Juha Nieminen <nospam@thanks.invalid>: Oct 10 09:29PM

> really quite bad. I wouldn't recommend anyone use
> it for anything." Do you agree that std::deque should
> be added to std::junkpile?
 
std::deque has features that other containers either don't
have, or are more inefficient about them.
 
std::deque does not need the same kind of resizing as std::vector
does, which may be relevant if you need to append lots of elements
individually (without knowin in advance how many of them there will be).
std::deque doesn't cause as much memory fragmentation as std::vector
(for the same reason.) Pointers to std::deque elements do not get
invalidated when new elements are appended (or prepended) to the
container, unlike std::vector.
 
std::deque offers random access, unlike std::list. std::deque also
makes significantly less memory allocations than std::list, making
it more efficient (and reducing memory fragmentation). std::deque
is a much more efficient queue structure (it's in its name!) than
either std::list or std::vector. (A queue structure is one where you
add elements to one end and pop them from the other.)
 
std::deque might be more efficient as a stack structure than std::vector,
but this one I'm not sure of, without actual experimentation. I suppose
it depends on how the stack will be used.
 
I regularly use std::deque when the need arises (especially when I need
a queue structure, which is exactly what the container has been designed
for.)
 
--- news://freenews.netfront.net/ - complaints: news@netfront.net ---
woodbrian77@gmail.com: Oct 10 03:11PM -0700

On Monday, October 10, 2016 at 4:29:51 PM UTC-5, Juha Nieminen wrote:
> is a much more efficient queue structure (it's in its name!) than
> either std::list or std::vector. (A queue structure is one where you
> add elements to one end and pop them from the other.)
 
Around the 3 minutes and 30 seconds mark of the talk that
I linked to above, Chandler says that they use their small
vector class as the basis for implementing queues. That's
kind of surprising to me. And at the time that I mentioned
in the original post, he says the constraints on std::deque
are such that "it has very few opportunities to be an
efficient data structure."
 
For now I took OO Tiib's advice to use std::queue. That
resulted in an 80 byte reduction in the size of the executable.
 
 
Brian
Ebenezer Enterprises - In G-d we trust.
http://webEbenezer.net
Jerry Stuckle <jstucklex@attglobal.net>: Oct 10 06:25PM -0400

On 10/10/2016 5:29 PM, Juha Nieminen wrote:
> a queue structure, which is exactly what the container has been designed
> for.)
 
> --- news://freenews.netfront.net/ - complaints: news@netfront.net ---
 
It's also much more efficient to delete items from the beginning or
middle of std::deque than std::vector.
 
--
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex@attglobal.net
==================
Juha Nieminen <nospam@thanks.invalid>: Oct 10 09:20PM

> In the same way, trailing return type, `auto`, is a single general
> notation that covers everything that the old function declaration syntax
> did, and more.
 
There are situations where the trailing return type is needed
because the traditional syntax doesn't suffice. However, how many
real-life cases have you encountered of this, in your code or other
people's code? Not artificial constructed cases made up to demonstrate
the usage, but actual code.
 
In practice the need is so exceedingly rare that it just doesn't make
sense to always use the more cumbersome syntax just so that the 0.01%
of cases where it's actually needed would fit.
 
(Also, how many of those trailing return type examples are such that
it wouldn't work with just the 'auto' return type without explicitly
specifying the trailing type, as per C++14?)
 
--- news://freenews.netfront.net/ - complaints: news@netfront.net ---
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: