Wednesday, June 20, 2018

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

"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Jun 20 11:24AM -0400

On 6/20/2018 11:04 AM, Joe Pfeiffer wrote:
> confusion, when I said it was a way to find bugs in your code I meant
> that what should happen in that case is an error exit. It should *not*
> be used (as others suggested I meant it to be used) to cover up errors.
 
Understood, and I agree.
 
To be honest, in my 30+ years of programming, I've never had a solid
teaching or belief on this issue. I've gone back-and-forth in my
thinking at times on what to do in those cases, and until your post
I've never had a solid direction.
 
Your simple reply has cleared up 30+ years of waffling, and given me
a solid course forward.
 
I also agree and disagree with the belief that you shouldn't use a
switch-in-a-loop coding style. It depends on what your goals are.
Sometimes it's nice to document everything when there are variables
per pass that can be set easily:
 
// Prior prologue code here
for (pass = 1; pass <= 3; ++pass)
{
// Prologue common code
 
switch (pass)
{
case 1: { x = 1; y = 9; z = 3; break; }
case 2: { x = 8; y = 6; z = 4; break; }
case 3: { x = 4; y = 1; z = 2; break; }
}
 
// Epilogue common code here
}
// Additional epilogue code here
 
In this type of model, when performance is not an issue, it greatly
aids in documenting the operation. You have a single source to view
the changes (if they can be aligned in this way, and in my particular
case they could be), and it is a nice way to organize your code. In
addition, the compiler should optimize out the code inefficiencies
and re-order things to be optimal for you. So, why not making it a
little easier for the next guy who comes after you to read and follow?
And if it does become a performance bottleneck, then refactor it.
 
Not everything written in C or C++ has to be blazing. Sometimes you
just need access to low-level abilities in some bits, but go ahead
and code other parts because you're there. I'm actually starting to
get away from that, which is why I made an announcement the other day
that CAlive will also support VXB code (an xbase language) natively,
so that the two are interchangeable without vxb {..} blocks as would
have been previously required. This will allow some operations to be
done in CAlive, and some in VXB, making the overall runtime faster
when needed, and more efficient as well (for the developer).
 
--
Rick C. Hodgin
Puppet_Sock <puppet_sock@hotmail.com>: Jun 20 09:35AM -0700

On Tuesday, June 19, 2018 at 2:16:51 PM UTC-4, Rick C. Hodgin wrote:
[snip]
> The things I teach people are not religion.
 
For some reason, I flashed on that scene from Crocodile Dundee
about "That's not a knife. THAT'S a knife."
 
That's not a religion.
 
http://www.khemorex-klinzhai.de/e/culture/rituals/marriage.html
 
> The Klingon hearts destroyed the gods who created them
> and turned the heavens to ashes.
 
THAT'S a religion.
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Jun 20 05:40PM +0100

On 20/06/2018 14:01, Scott Lurndal wrote:
 
>> All people were created in the image and likeness of a god.
 
> Actually, all people evolved from collections of amino acids. So
> the rest of your thesis is null and void. Take it somewhere else.
 
Try not to confuse abiogenesis with evolution: they are two separate
processes but Kooky Rick will deny both of them just as he denies that the
speed of light in a vacuum coupled with what we can observe in the night
sky falsify his crazy 7000 year old Earth theory. He puts it all down to
a deception of Satan. You can't really have a sensible debate with that
kind of crazy.
 
/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."
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Jun 20 12:43PM -0400

On 6/20/2018 12:35 PM, Puppet_Sock wrote:
 
>> The Klingon hearts destroyed the gods who created them
>> and turned the heavens to ashes.
 
> THAT'S a religion.
 
 
I remember that. I remember when I heard it (back before I was a
Christian) thinking, "Oh ... how awful."
 
The Bible does warn about gods, by the way (lower-case g, and plural).
It says there are gods, but there is only one God Almighty, who is
God the Father, Son, Holy Spirit.
 
The Bible is logical. God created everything. He used a certain
type of "mixture" when He did it, and it's all held together with
truth. His Son, Jesus Christ, /is/ truth. Sin is non-truth.
 
So sin cannot exist in God's Kingdom. It's like a cancer trying
to exist in a body. That cancer destroys everything it touches.
 
It's why God isolates sin into a special place of confinement
called Hell. And it is filled with fire and brimstone so the
individual who wields sin (who is that cancer destroying the
healthy body) cannot move. Cannot think. Can only sit there and
respond to the pain with agony unending.
 
God gives everyone a chance to be a part of His Kingdom. He will
forgive all of our sin. But only those who will acknowledge their
sin as sin, repent of the same, and move forward, will be saved.
The rest will literally perish in their sin.
 
There are two births, and two deaths, one of the flesh, one of the
spirit. Those who are born twice will only die once, for the first
birth is flesh, the second is spirit and is eternal. But those who
are only born once will die twice, first in the flesh, and then in
eternity in Hell (Revelation 19).
 
--
Rick C. Hodgin
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Jun 20 09:50AM -0700

[Note: I still see your posts on Google Groups]
 
On Wednesday, June 20, 2018 at 12:40:33 PM UTC-4, Mr Flibble wrote:
> sky falsify his crazy 7000 year old Earth theory. He puts it all down to
> a deception of Satan. You can't really have a sensible debate with that
> kind of crazy.
 
I do not, Leigh. You misrepresent me. You do not listen to the things
I write. You assume over them and you make mistakes.
 
I told you that when we (developers) create a game scene in some game,
it is fully formed. Your NeoGFX does something similar in generating
a form. All of the parts are there. We create the foreground, the
background, and it all appears and is usable the moment that scene is
enabled.
 
With God, who operates on universe scales with infinite resources,
there's nothing illogical about Him creating everything where it is,
and then setting it in motion for our benefit.
 
God Almighty can wield universes like we wield computer software
instances. The difference is we are uncaring toward our creations.
He gave His creation a breath of life, and He does care about it.
He gives us the opportunity to become His sons and daughters.
 
You'll miss it, Leigh ... unless you seek the truth. It breaks my
heart to see you believing and repeating lies about what you think
I believe when you've been told information to the contrary multiple
times.
 
--
Rick C. Hodgin
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Jun 20 05:56PM +0100

On 20/06/2018 17:50, Rick C. Hodgin wrote:
 
> With God, who operates on universe scales with infinite resources,
> there's nothing illogical about Him creating everything where it is,
> and then setting it in motion for our benefit.
 
If God created everything where it is 7000 years ago the night sky would
be almost empty as we couldn't observe things further than 7000 light
years away. Sorry mate but your crazy creationist theory just doesn't
hold water; it doesn't stand up to observable facts and logic.
 
> heart to see you believing and repeating lies about what you think
> I believe when you've been told information to the contrary multiple
> times.
 
Sadly it is you who believes fictions as the truth and there is no helping
you as you are too far gone.
 
/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."
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Jun 20 10:48AM -0400

On 6/20/2018 10:12 AM, David Brown wrote:
>>> That's how you find bugs in your code. Do it.
 
>> That's the answer. Thank you.
 
> It is /an/ answer - but not /the/ answer. And it is not a good answer.
 
I disagree. To not have that code in there introduces the possibility of
there being an unexpected error at runtime which causes a crash, and the
cause of the crash may then be unknown as it may propagate to some other
point which calls something which crashes there and you don't know the
true source or root of the issue.
 
To have the default: code in there would do very little (mildly pollute
the instruction cache with typically unused opcodes, but those could be
minimized by simply having a call instruction in there), and it would
give root diagnostic information when something goes awry.
 
I am totally on board with Joe's concept here. I think it's brilliant.
It's a correct philosophy in my judgment, and I intend to incorporate it
at all points in my development in moving forward.
 
I may even add a compiler switch to CAlive to enable this kind of auto-
identifying of unspecified code without having to type them in when some-
thing like my example (without a default:) is given, or a way to at least
catch all passes that are un-tested, such as:
 
if (a == 1) {
// code here
} else if (a == 5) {
// code here
}
 
In this case there's no else {..} block there. The switch would auto-
inject an else {..} block in there and have it call a function with
line information allowing that location to be trapped and observed.
 
It's all useful information, and it's another tool in the toolbox.
 
-----
I know you disagree. I won't debate you. It won't affect you anyway
because it's going to be in CAlive, and you'll never use CAlive ... so
don't let it bother you.
 
--
Rick C. Hodgin
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Jun 20 11:42AM -0700

On Wednesday, June 20, 2018 at 12:56:25 PM UTC-4, Mr Flibble wrote:
> be almost empty as we couldn't observe things further than 7000 light
> years away. Sorry mate but your crazy creationist theory just doesn't
> hold water; it doesn't stand up to observable facts and logic.
 
He could put the light there en-route, Leigh.
 
> > times.
 
> Sadly it is you who believes fictions as the truth and there is no helping
> you as you are too far gone.
 
You say what you believe about evolution is true. But there is a
huge and growing body of evidence that it's false. Even staunch
evolutionists like Richard Dawkins are now believing in intelligent
design (thanks largely to genetic research which describes how
complex DNA is). So now we get wild theories like aliens came here
and seeded our planet, and they grew up in some kind of Darwinian
evolution.
 
There's a man who dedicated a whole series to prove how wrong it is,
and how many things we've been taught in school were proven wrong
even 140+ years ago:
 
Lies in the textbooks:
https://www.youtube.com/watch?v=yKYTH-fkg5Q
 
It continues through many days after that. The series just ended a
few days ago actually.
 
--
Rick C. Hodgin
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Jun 20 08:35PM +0100

On 20/06/2018 19:42, Rick C. Hodgin wrote:
>> years away. Sorry mate but your crazy creationist theory just doesn't
>> hold water; it doesn't stand up to observable facts and logic.
 
> He could put the light there en-route, Leigh.
 
Of course he did! As I said you are too far gone.
 
> complex DNA is). So now we get wild theories like aliens came here
> and seeded our planet, and they grew up in some kind of Darwinian
> evolution.
 
False assertion made without evidence. Assertions made without evidence
can be summarily dismissed without evidence.
 
> https://www.youtube.com/watch?v=yKYTH-fkg5Q
 
> It continues through many days after that. The series just ended a
> few days ago actually.
 
Speed of light 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."
scott@slp53.sl.home (Scott Lurndal): Jun 20 07:59PM

>> evolution.
 
>False assertion made without evidence. Assertions made without evidence
>can be summarily dismissed without evidence.
 
Yeah, and RCH is bearing false witness vis-a-vis Professor Dawkins. If it so
easy for RCH to lie about Professor Dawkins, well, that says much about RCH.
 
 
"Dawkins is a prominent critic of creationism, a religious belief that humanity, life, and
the universe were created by a deity[130] without recourse to evolution."
 
"The Blind Watchmaker, contains a sustained critique of the argument from design,"
 
"Dawkins has opposed the inclusion of intelligent design in science education, describing it as "not a scientific argument at all, but a religious one"
Ben Bacarisse <ben.usenet@bsb.me.uk>: Jun 20 09:39PM +0100

"Rick C. Hodgin" <rick.c.hodgin@gmail.com> writes:
<snip>
> I also agree and disagree with the belief that you shouldn't use a
> switch-in-a-loop coding style.
 
I'm not certain (though I've not gone back to check) that that was the
point being made. The problem is a pattern that needlessly introduces
the possibility of an error. Enumerating passes is just a very simple
state machine, and that's often done with a loop and a switch.
 
 
> // Epilogue common code here
> }
> // Additional epilogue code here
 
If you must do this, you can avoid the current issue altogether like
this:
 
for (int pass = 1; pass > 0; pass++) {
switch (pass) {
case 1: printf("specific code for pass %d\n", pass); break;
case 2: printf("specific code for pass %d\n", pass); break;
case 3: printf("specific code for pass %d\n", pass); break;
case 4: pass = -1; continue;
}
printf("common code for pass %d\n", pass);
}
 
It's not free from potential problems either (what code is?) but there's
no need to add error cases that don't otherwise naturally arise.
 
(Depending on the actual code, you might prefer to replace the case 4
with a default case label, and in case it is not clear, I still prefer
to use functions. You get all sort of benefits from adding functions,
not least of which is having more and simpler testable units.)
 
--
Ben.
David Brown <david.brown@hesbynett.no>: Jun 20 10:42PM +0200

On 20/06/18 16:48, Rick C. Hodgin wrote:
> cause of the crash may then be unknown as it may propagate to some other
> point which calls something which crashes there and you don't know the
> true source or root of the issue.
 
The default clause there makes the code continue on - hiding the problem
far better than a crash would. If the default clause were to print an
error message an exit, you would have a point.
 
But even if you did that, it is still a bad technique. First, it is
always better to write code that clearly can't go wrong than to write
code that spots when something has gone wrong. Second, it is always bad
to write untestable code.
 
I have seen this sort of coding in practice. I have seen where the
so-called "safety" code goes wrong and gets triggered unexpectedly, and
then mishandles it - all because that code was never tested or checked.
 
> the instruction cache with typically unused opcodes, but those could be
> minimized by simply having a call instruction in there), and it would
> give root diagnostic information when something goes awry.
 
Your example does not give any diagnostic information - it hides the
problem. And it is not the waste of instruction cache that bothers me -
it is the untestable code.
 
There are certainly times when you want to write code that has extra
checks for things that you think should not happen. That is what the
"assert" macro is for. But when you can structure your code so that the
failure cannot occur, prefer that method - and it is easy to do in cases
like this.
 
 
> I am totally on board with Joe's concept here.  I think it's brilliant.
> It's a correct philosophy in my judgment, and I intend to incorporate it
> at all points in my development in moving forward.
 
I can't teach you to be a better programmer. I can only offer advice in
answer to your question.
 
 
> In this case there's no else {..} block there.  The switch would auto-
> inject an else {..} block in there and have it call a function with
> line information allowing that location to be trapped and observed.
 
I often write a sequence of tests like this in my code. And I most
certainly do /not/ want a default case if I have not written one myself.
 
> I know you disagree.  I won't debate you.  It won't affect you anyway
> because it's going to be in CAlive, and you'll never use CAlive ... so
> don't let it bother you.
 
It does not bother me, as such. It is a little frustrating to see
someone latch onto such a bad idea as though it was the best thing since
sliced bread, but it will not keep me awake at night. As you say, I
would not ever use CAlive - it is riddled with with such poorly
considered ideas. But you make it the way you want it to be - take my
advice or leave it.
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Jun 20 02:05PM -0700

On Wednesday, June 20, 2018 at 3:59:31 PM UTC-4, Scott Lurndal wrote:
> Yeah, and RCH is bearing false witness vis-a-vis Professor Dawkins.
> If it so easy for RCH to lie about Professor Dawkins, well, that
> says much about RCH.
 
I have not lied. In an interview with Ben Stein for the movie "No
Intelligence Allowed" he states that nobody knows how life started,
but includes discussion on how intelligent design might have come
about:
 
https://www.youtube.com/watch?v=BoncJBrrdQ8
 
In The Blind Watchmaker, he says that what we see has the appearance
of intelligent design, but holds to the idea that it is of random
Darwinian-like processes.
 
http://transcripts.cnn.com/TRANSCRIPTS/0804/18/sitroom.02.html
 
"Biology is the study of complicated things that give the
appearance of having been designed for a purpose."
-- Richard Dawkins, The Blind Watchmaker
 
You put these two together and he has not flatly dismissed intelligent
design, stating that life appears to be created by intelligent design,
but what it does incorporate from Dawkins' is that it could not have
come from God. He states that aliens could've seeded the planet, and
that it's an intriguing possibility to him.
 
Richard Dawkins' primary driving force, though, in his total denial of
God. He doesn't want to be held accountable to anyone. But, he is now
getting quite old (77 years) and his time is almost up. He will soon
learn the truth about the nature of our existence.
 
Something that did embarrass Richard Dawkins' in front of people was
this panel discussion. Craig Venter, a renowned DNA sequencing ex-
pert who has sequenced over 60 million genes from ocean sampling,
as well as many other forms, tells the panel that there is no tree
of life, but rather a "bush of life" (meaning sources which seem to
have clearly each originated on their own, as per the intelligent
design model where each one was crafted for itself, and they did
not have a common ancestor):
 
https://www.youtube.com/watch?v=A0ZLJP9Zc9U
 
Richard Dawkins goes into damage control mode and does a video with
Craig Venter where he leads the discussion and continuously re-asserts
Darwinian evolution, and to much disappointment, Craig Venter appears
to go along with it as he does not refute it, but just let's Dawkins
speak. This "uncut" version published by the "Richard Dawkins
Foundation for Reason & Science" YouTube channel:
 
"Craig Venter - The Genius of Charles Darwin: The Uncut
Interviews - Richard Dawkins"
https://www.youtube.com/watch?v=3E25jgPgmzk
 
Even the title there makes it sound like Craig Venter is on board
with evolution. From the earlier interview before the damage control
mode, he was not. Venter said the tree of life is a holdover from an
early viewpoint that isn't really holding up to modern scientific
scrutiny.
 
Since then, Craig Venter has gone on to do additional research, but
has (to my knowledge) remained largely quiet about the issue of the
origin of life. I've wondered why that is because it seems to have
been triggered from this panel interview, the subsequent damage control
video, and thereafter.
 
-----
Modern genetics has revealed such complex patterns in our DNA that
it is no longer possible to hold to evolutionary theories. The reason
is because our DNA is sequenced in multiplexed ways, meaning a single
strand of DNA, that's copied to RNA and processed, can go through more
than a single processing machine. In one machine it may use a section
from here to there, and in another, it may use a different section.
And yet a third it may use another. And to date they've discovered up
to twelve separate uses for a single strand of DNA through twelve sep-
arate machines. To make a single change to that DNA would result in
having to make a change that aligns with all twelve machines simultan-
eously, and that's just not possible.
 
In addition, we now know the cause of many genetic diseases and some
of our abnormalities. Single bit errors in our entire strand of DNA
can result if fatal or severely debilitating diseases.
 
The "junk DNA" they used to believe was leftover as a type of evolu-
tionary baggage, has now been found to be 80% expressed in our bodies,
and that's only what they can rigorously prove. The remaining 20% is
believed to also be used, but they cannot prove it yet.
 
There are scientists who look at the data in DNA and still believe in
Darwinian evolution, but their arguments are very easily dismissed as
non-science when they are scrutinized. When you begin to question how
you get from A to B to C in the few million years that are stated, there
is not one viable model. They have not found any transition fossils.
Thy have found incredible explosions of life which seem to have just
appeared out of nothing. And they do find evidence of Noah's Flood,
and the creation of different kinds of animals in the laboratory today.
Those things can be proven with scientific methods which lend credence
to the Biblical account. There simply is no such evidence for the
evolutionary account. In fact, the belief in evolution is even more
of a matter of faith than creation is because we see point after point
after point which backs up the Biblical account of creation.
 
Even the root Chinese alphabet contains aspects of the Biblical account:
 
https://answersingenesis.org/genesis/chinese-characters-and-genesis/
 
The symbols used for some of the words are comprised of symbols which
talk about Noah and his family on the ark, for example, and
 
> the universe were created by a deity[130] without recourse to evolution."
 
> "The Blind Watchmaker, contains a sustained critique of the argument from design,"
 
> "Dawkins has opposed the inclusion of intelligent design in science education, describing it as "not a scientific argument at all, but a religious one"
 
You are being deceived by old information and lies told to you from
back then. There is new information in all areas of genetics research
which absolutely deny the possibility of evolution.
 
Look at the research. And do not follow mainstream technical journals.
You cannot be mainstream in this world without "towing the party line."
You have to look at the science, and the scientists who come forth and
state things credibly, and not just by mass groups.
 
And look at "the other side" of the argument. Dr. Georgia Purdom is a
geneticist who has done research and analyzed other people's research:
 
https://www.youtube.com/watch?v=0ACCIu3jPrc
 
And look at this movie which demonstrates how DNA actually works (from
2012, the models have been advanced since then and reveal even more
complex operations that literally are mind boggling):
 
Programming of Life:
http://www.youtube.com/watch?v=00vBqYDBW5s
 
--
Rick C. Hodgin
David Brown <david.brown@hesbynett.no>: Jun 20 11:10PM +0200

On 20/06/18 22:39, Ben Bacarisse wrote:
 
> If you must do this, you can avoid the current issue altogether like
> this:
 
> for (int pass = 1; pass > 0; pass++) {
 
Here I would use:
 
for (int pass = 1; true; pass++) {
 
"pass > 0" is a tautology - it is always true - but it looks like a test.
 
 
legalize+jeeves@mail.xmission.com (Richard): Jun 20 07:38PM

[Please do not mail me a copy of your followup]
 
There's been lots of discussion about TDD on this newsgroup lately. A
reader contacted me offline asking about seeing TDD worked on a
non-trivial real world example.
 
Is this something of interest to the group?
 
Here is my thinking:
 
First, we agree on an example problem. This could be a "greenfield"
project[1], e.g. a brand new code base starting from scratch. Or it
could be a "brownfield" project[2]. Greenfield projects are easier to
demonstrate TDD, but some feel that their lack of integration into a
larger context avoids addressing the difficulties of adopting TDD into
an existing code base.
 
Once the problem is agreed upon, I'll setup a google hangout, skype
call, youtube stream or whatever, to work the problem for a fixed amount
of time, probably an hour. I might do follow-on sessions if that is
deemed useful.
 
We can organize the session in one of several ways. First, it could
simply be a tutorial where I give commentary while I work the problem.
Questions from the audience are fine. Second, we could arrange it in
a "mob programming" or "randori" style session where I drive the IDE
and provide commentary, but the decisions of which tests to tackle and
how to guide the implementation are decided by the audience. This
style is more interactive, but tends to go a little slower due to the
distributed decision making and the fact that the group are strangers
to each other, so there isn't an assumed common shared culture about
how to proceed.
 
[1] <https://en.wikipedia.org/wiki/Greenfield_project>
[2] <https://en.wikipedia.org/wiki/Brownfield_(software_development)>
--
"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>
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Jun 20 08:44PM +0100

On 20/06/2018 20:38, Richard wrote:
> how to proceed.
 
> [1] <https://en.wikipedia.org/wiki/Greenfield_project>
> [2] <https://en.wikipedia.org/wiki/Brownfield_(software_development)>
 
I would rather stick pins in my eyes.
 
/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."
Daniel <danielaparker@gmail.com>: Jun 20 12:55PM -0700

On Wednesday, June 20, 2018 at 3:38:13 PM UTC-4, Richard wrote:
.>
> First, we agree on an example problem.
 
I would suggest starting from a published specification, and using that as the
requirements. My vote would be for Json Content Rules
 
https://tools.ietf.org/html/draft-newton-json-content-rules-09
 
Daniel
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Jun 20 03:51PM -0400

It's been nice to be back here for a few days. I'll be back again
at some future time.
 
I want to encourage each of you in the things I've taught about.
 
Think about them when you're alone and without distraction. Remember
the reasons why I take the time to write you these things I do. It's
because I care about you and want you to know the truth. That truth
will guard your heart and mind and keep your feet on solid ground, not
being carried away by every wind of subtle doctrine.
 
If you care about yourself and your soul ... investigate these things.
 
Be good. Do well. Or vice-versa. :-)
 
--
Rick C. Hodgin
bitrex <user@example.net>: Jun 20 02:31PM -0400

Say I have some kind of arbitrary type called Foo that I would like to
wrap in a templated wrapper class, like say EventData<Foo>. The
EventData wrapper will be constructed to hold a pointer or reference to
a local object on the stack.
 
I'd then like to pass a wrapper of arbitrary template type to a
non-template function call via pointer to the base type e.g.
EventDataBase* parameter (there is a possibility this could be null so
likely have to use pointers in this call instead of a reference to the
base type.) Then work with the underlying Foo-type in that function
transparently as compared to how I would work with the original type in
the caller prior to being wrapped up and passed.
 
What would be a good way to implement this structure? Would it be more
appropriate to store a reference to the template type in the wrapper
class vs pointer to express that its lifetime is dependent on the
lifetime of the local object it wraps?
Chris Vine <chris@cvine--nospam--.freeserve.co.uk>: Jun 20 05:51PM +0100

On Wed, 20 Jun 2018 14:13:29 +0200
David Brown <david.brown@hesbynett.no> wrote:
[snip]
 
> No, that does not make them "by definition unhygienic" - at best, you
> are defining "unhygienic" as "what C macros are", which is not at all
> helpful.
 
That's wrong.
Keith Thompson <kst-u@mib.org>: Jun 20 10:48AM -0700

> On Wed, 20 Jun 2018 08:06:27 +0200
> David Brown <david.brown@hesbynett.no> wrote:
>> On 19/06/18 22:28, Chris Vine wrote:
[...]
> when it injects its own identifier names into the call site; in short,
> when it does something at macro expansion time which could cause
> identifier names to be accidentally captured or shadowed.
 
Apparently the term "hygienic macro" is in some general use. Wikipedia
defines them as "macros whose expansion is guaranteed not to cause the
accidental capture of identifiers". The problem is collisions between
identifiers defined within the macro and identifiers in the scope
surrounding the macro invocation.
 
https://en.wikipedia.org/wiki/Hygienic_macro
 
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Chris Vine <chris@cvine--nospam--.freeserve.co.uk>: Jun 20 07:14PM +0100

On Wed, 20 Jun 2018 10:48:30 -0700
> identifiers defined within the macro and identifiers in the scope
> surrounding the macro invocation.
 
> https://en.wikipedia.org/wiki/Hygienic_macro
 
Indeed, although I would include "accidental shadowing" as an addition
to "accidental capture".
 
None of this is novel, or specific to C. Common lisp (defmacro) macros
are unhygienic if used naively, although the injection of local
identifiers into call sites is addressed by using gensym, which is
guaranteed to provide unique (non-clashing) identifier names. The
binding of identifiers at the call site rather than the definition site
is largely circumvented by lisp 2's placing of function names in a
different namespace from other names, and by prohibiting the rebinding
of core function names.
 
By contrast scheme's syntax-rules/syntax-case macros are wholly hygienic
by default, as are its renaming macros. Reputedly rust's macro's are
also hygienic although I have not written any rust code to verify that.
Rosario19 <Ros@invalid.invalid>: Jun 20 05:15PM +0200

does exist one data structure that if N is the number of elements in
it it has at last O(log(N)) for insert and O(log(N)) for search?
 
i think could be ok binary tree, i wrote something for that
and seems ok; but binary tree admit the insert of duplicate elemnts?
it seems yes but possible here i think wrong...
 
it would be one hash table too
but tipically it has to have its N as 1_000_000 of elements or
16_000_000 of chars in a pc that has not too much memory...
 
It would be possible using hash tables for big number of elements to
save?
Robert Wessel <robertwessel2@yahoo.com>: Jun 20 12:13PM -0500

On Wed, 20 Jun 2018 17:15:59 +0200, Rosario19 <Ros@invalid.invalid>
wrote:
 
>16_000_000 of chars in a pc that has not too much memory...
 
>It would be possible using hash tables for big number of elements to
>save?
 
 
Some sort of binary tree will have those performance requirements. But
you'll want to pick a type that's self-balancing. Red-black trees are
a fairly simple, and popular, choice.
 
Some tree structures can handle duplicate keys, others can't, but even
the ones that can't, can be adapted by adding a sequence number to
each element, and using that as the low part of the key.
red floyd <dont.bother@its.invalid>: Jun 20 10:58AM -0700

On 6/20/2018 8:15 AM, Rosario19 wrote:
> 16_000_000 of chars in a pc that has not too much memory...
 
> It would be possible using hash tables for big number of elements to
> save?
 
Please do your own homework.
 
This is also off-topic for comp.lang.c++.
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: