Saturday, August 20, 2016

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

David Brown <david.brown@hesbynett.no>: Aug 20 06:31PM +0200

On 19/08/16 15:23, jacobnavia wrote:
 
> Several parallel development threads started synchronously at a given time:
 
> o behavioral
> o physical (lungs, legs for movement in land)
 
 
No, you have misunderstood a fundamental aspect of natural evolution.
Your explanation here works if you believe there was a guiding force
involved (leading fish to evolve lungs so that they could conquer the
land, for example).
 
Natural selection works mostly through a very large number of /very/
small steps - punctuated by occasional random mutations that have a much
larger effect.
 
Fish gills already work for breathing in air - they just do it very
badly. (The same applies for lungs trying to breath in water - you can
get oxygen from your first breath, but are unable to clear the water out
to get in new oxygenated water.) Some fish gradually became better at
breathing air, probably by a combination of odd mutations that gave
bigger steps, but mostly because fish which were able to stay a little
longer out of the water were able to get more food, or able to avoid
being eaten slightly better than their kin.
 
The change leading to legs for walking was basically independent. There
are fish that walk (on the bottom of the water), fish that breath air,
and fish that do both. There still are fish with such combinations, and
there were fish that developed these traits long ago.
 
And gradually, over a huge span of time, some of these fish found that
they got on better if they stayed longer on land. Eventually, they did
not need to return to water except for specific purposes such as
egglaying, and amphibians evolved.
 
But when you talk about "fish evolved lungs so that they could live on
land", you are talking about a /plan/ for evolution - you require an
external force to guide it, because natural selection has no plan.
 
 
> The same for intelligence.
 
> We just do not know how innovation appears in the development of life.
> How completely NEW features arise.
 
Actually, we have a fair idea of many of the mechanisms - though of
course the picture is not complete.
 
 
> Does life steers its species into new ecological niches?
 
> We do not know.
 
As far as we (i.e., "science") knows, life does /not/ steer its species
into new niches. Species gradually move into new niches when they are
able, and they evolve to better suit their current niche - they do not
evolve or change with the intention of moving into a new niche.
 
 
> Natural selection exists, of course, and it explains many things. The
> big problem is that the discovery of new features is, in my humble
> opinion, unexplained.
 
You are far from alone in believing there is some guiding force -
whether it be a "god", or some all-encompassing life-force, "Mother
Nature", etc. I hope I don't come across as critical of such beliefs.
But you should understand that based on the science (evidence, facts,
theories) we have, there is no /requirement/ for such a guidance - our
understanding of life, biology and evolution works fine without such a
force.
Dombo <dombo@disposable.invalid>: Aug 20 08:06PM +0200

Op 18-Aug-16 om 10:17 schreef David Brown:
 
> There is a lot of marvellous stuff in biology, but much of it is vastly
> over-complicated, full of mistakes, rushed "cut and paste" jobs with
> bits left over, sub-optimal systems, and so on.
 
That would be excellent description of the C++ projects with legacy of
15+ years I often see at my clients.
jacobnavia <jacob@jacob.remcomp.fr>: Aug 20 08:41PM +0200

Le 20/08/2016 à 20:06, Dombo a écrit :
>> bits left over, sub-optimal systems, and so on.
 
> That would be excellent description of the C++ projects with legacy of
> 15+ years I often see at my clients.
 
Life IS legacy code OF COURSE!
 
I am running the code my father and my mother legated to me some spring
back then, a long time ago.
 
The code mostly works OK, and I have arrived healthy at some age. Yes,
it is not conceived FOR ME, since I will pass away. Organisms, cells and
even planetary global ecosystems live and die. I am not an exception.
 
It works, and I am living thanks to that code in my DNA. That code is
knowledge about physics and quantum mechanics at an incredible level. It
has the recipes for accelerating and turning around chemical reactions
in an incredible scale. Those molecular machines (the enzymes) know how
to put molecules near one another and establish a tunnel through the
energy barrier of the reaction by putting those atoms in a certain way,
the "active site" of the enzyme.
 
Evidently the sequences of DNA encoding that knowledge about quantum
phenomena encapsulate that knowledge in a kind of book. That knowledge
can be then used by living beings.
 
Where do those recipes come from?
 
Is life on earth a being using that previous knowledge that was stored
in space?
 
Life on earth arose almost immediately after the planet cooled. It could
very well be that the recipes for life were already present in the
primitive gas cloud that gave birth to the sun and the planets. In
systems where stars are being born, we discover enormous quatities of
organic material: alcohols, sugars, and many other things that we are
unable to detect yet.
 
The appearence of life is very difficult to prove for the first
organisms, that left few traces. Besides, rocks older than 4Gyears are
impossible to find. The last date I have in mind was around 3.7Gyears
for the oldest fossiles, but there was even earlier reports,
controversial for some. That leaves a window of a few hundred million
years to evolve a living being, since the earth should be just 4.5Gyears
old, and in the first millions of years the planet was just fluid
lava... not a very nice place to live.
 
And in only that lapse of time living beings started living in this
planet. I would guess evolution here did not started at zero.
jacobnavia <jacob@jacob.remcomp.fr>: Aug 20 09:16PM +0200

Le 20/08/2016 à 18:31, David Brown a écrit :
> Your explanation here works if you believe there was a guiding force
> involved (leading fish to evolve lungs so that they could conquer the
> land, for example).
 
The usual explanation is that fish living in places where nourishment
was abundant but on land, or fish that lived in environments that dried
up had a competitive advantage relative to others if they started
developing lungs.
 
They survived better the dry periods on land, a few hours at first, then
longer etc.
 
True but life was already in this planet for BILLIONS of years and those
environments never led to anything on land. Life lived happily in the
seas for billions of years without ever evolving land animals.
 
Plants (and not animals of course) are the true outposts of life, and
they colonized the land earlier. But relatively late, around 1.3Gyears ago.
 
Life started producing oxygen in the land, and provoked a climate
catastrophe that engulfed the planet in a snowball.
 
Lichens and other small microscopic plants started colonizing land and
transforming all the CO2 into plant material, eliminating its greenhouse
effect from the atmosphere. This provoked a global cooling of immense
proportions, and the ice caps of both poles met at the equator for
millions of years. Earth was a snowball.
 
Life went underground and survived under the ice caps, until outgassing
from volcanoes restored the CO2 again and the ices left the place to
life again.
 
Animals were nice to keep the plants in check. They breathe oxygen and
RESTORE CO2 into the atmosphere. And they eat plants.
 
Checks and balances. Life can learn from mistakes. In a recent article,
two scientists say:
 
<quote>
"Learning theory enables us to formalise how evolution changes its own
processes over evolutionary time. For example, by evolving the
organisation of development that controls variation, the organisation of
ecological interactions that control selection or the structure of
reproductive relationships that control inheritance -- natural selection
can change its own ability to evolve.
 
https://www.sciencedaily.com/releases/2015/12/151218085616.htm
 
"If evolution can learn from experience, and thus improve its own
ability to evolve over time, this can demystify the awesomeness of the
designs that evolution produces. Natural selection can accumulate
knowledge that enables it to evolve smarter. That's exciting because it
explains why biological design appears to be so intelligent."
<end quote>
 
Life learns from previous mistakes.
jacob navia <jacob@jacob.remcomp.fr>: Aug 20 09:23PM +0200

Sorry, forgot the references:
http://science.psu.edu/news-and-events/2001-news/Hedges8-2001.htm
 
First Land Plants and Fungi Changed Earth's Climate, Paving the Way for
Explosive Evolution of Land Animals, New Gene Study Suggests
Stuart Redmann <DerTopper@web.de>: Aug 21 01:04AM +0200


> I know I shouldn't click on the C++ Middleware Writer thread, but having done
> so, I have to say your post made excellent reading, thanks for that.
 
> Daniel
 
+1
 
Stuart
Paavo Helde <myfirstname@osa.pri.ee>: Aug 21 02:09AM +0300

On 19.08.2016 0:49, jacobnavia wrote:
 
> lacking some essential pieces, but that is the primates story. Just
> animals, like so many others and yet one day, they decided to walk upright.
 
> So that they can see clearly the stars.
 
I have heard the hypothesis that because of some climate change lots of
forests turned into hot savannas, and the animals who could walk upright
had better chances to survive there as the body area directly exposed to
the sun was minimized. Sounds plausible to me (at least explains hair).
Not many animals could walk upright though because keeping the balance
takes a lot of spare processing power.
 
Walking upright has nothing to with seeing stars, anyway. For seeing
stars it would help to have eyes on top of your head, like crocodiles.
 
Cheers
Paavo
David Brown <david.brown@hesbynett.no>: Aug 21 01:20AM +0200

On 20/08/16 20:06, Dombo wrote:
>> bits left over, sub-optimal systems, and so on.
 
> That would be excellent description of the C++ projects with legacy of
> 15+ years I often see at my clients.
 
Isn't it just a description of anyone else's code? :-)
Lynn McGuire <lynnmcguire5@gmail.com>: Aug 20 05:20PM -0500

What do people use for automated testing of C++ Windows apps ?
 
Our app has 200+ dialogs, a calculation engine, 600K lines of code of C++,
 
We have some automated single stage testing now but I would like to add some automated multiple stage testing.
 
I am digesting a couple of good articles:
http://www.drdobbs.com/testing/dont-develop-gui-tests-teach-your-app-to/240168468
and
http://stackoverflow.com/questions/1287425/automated-testing-for-c-c-gui-applications
 
Thanks,
Lynn
"Öö Tiib" <ootiib@hot.ee>: Aug 20 03:34PM -0700

On Sunday, 21 August 2016 01:20:36 UTC+3, Lynn McGuire wrote:
> What do people use for automated testing of C++ Windows apps ?
 
List is there,
https://en.wikipedia.org/wiki/List_of_GUI_testing_tools
I have participated in project that used TestComplete.
 
My impression is that you need to reserve couple of programmers
full time to script those tests since GUI tends to change most
rapidly.
bleachbot <bleachbot@httrack.com>: Aug 17 07:39PM +0200

red floyd <no.spam.here@its.invalid>: Aug 19 06:40PM -0700

On 8/19/2016 2:55 PM, Rick C. Hodgin wrote:
> 06: #define abc(a, b, c = "hello") a(b, c)
> 07:
> 08: abc(myfunc, 2);
 
Since neither response so far has addressed your question,
 
No. There is no such thing as default arguments for macros.
Ian Collins <ian-news@hotmail.com>: Aug 20 02:50PM +1200

On 08/20/16 02:10 PM, Rick C. Hodgin wrote:
>> 5 five
 
> I appreciate your response, Ian. There are things about this I don't
> understand, but since it's clc, I'll let it go.
 
Seeing as you also asked there, I've cross-posted to c.l.c++ so you can
follow up there.
 
--
Ian
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Aug 19 07:59PM -0700

On Friday, August 19, 2016 at 10:50:59 PM UTC-4, Ian Collins wrote:
> > understand, but since it's clc, I'll let it go.
 
> Seeing as you also asked there, I've cross-posted to c.l.c++ so you can
> follow up there.
 
I don't expect a tutorial on C++, but the things I don't understand are as
follows:
 
01: template <typename Fn, typename B>
02: void abc( Fn a, B b, const char* c = "no param given" ) { a(b, c); }
 
typename Fn
typename B
 
Why "typename"? Why "Fn"? And why "B"? Could other symbols have been used,
or are those explicit in C++ (such that "Fn" means function)?
 
What's the purpose of the { and } here? Are they defining the template? And
is the template in this small case being only the translation? Would this
code expand out to essentially perform what a #define would do, modifying the
original source code:
 
abc(myfunc, 2);
abc(myfunc, 5, "five");
 
To then product translated source code through the template:
 
myfunc(2, "no param given");
myfunc(5, "five");
 
?
 
At least it seems to be that way from looking at the generated assembly
source code.
 
Best regards,
Rick C. Hodgin
Ian Collins <ian-news@hotmail.com>: Aug 20 03:11PM +1200

On 08/20/16 02:59 PM, Rick C. Hodgin wrote:
> typename B
 
> Why "typename"? Why "Fn"? And why "B"? Could other symbols have been used,
> or are those explicit in C++ (such that "Fn" means function)?
 
They are simply template arguments. Any name could have been used, just
like function parameters.
 
> What's the purpose of the { and } here? Are they defining the template?
 
abc is a function template, the stuff between the braces is the function
body, just like a normal function.
 
 
> ?
 
> At least it seems to be that way from looking at the generated assembly
> source code.
 
Pretty much, yes - assuming the function was inlined.
 
It would have generated a function with the signature
 
void abc( void (*a)( int,const char*), int b, const char* c);
 
--
Ian
Kalle Olavi Niemitalo <kon@iki.fi>: Aug 20 10:32AM +0300


> typename Fn
> typename B
 
> Why "typename"?
 
"typename" is a reserved word that here means that the "Fn" and
"B" arguments of the template are types (rather than templates,
constant values, or addresses of objects). "class" would also
mean the same thing here, i.e. you could write "template <class
Fn, class B>", but it might be a bit misleading because the types
do not have to be class types.
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Aug 20 02:39PM +0200

On 20.08.2016 03:40, red floyd wrote:
>> 08: abc(myfunc, 2);
 
> Since neither response so far has addressed your question,
 
> No. There is no such thing as default arguments for macros.
 
Well technically he could use a variadic macro.
 
 
Cheers!,
 
- Alf
David Brown <david.brown@hesbynett.no>: Aug 20 06:40PM +0200

On 20/08/16 09:32, Kalle Olavi Niemitalo wrote:
> mean the same thing here, i.e. you could write "template <class
> Fn, class B>", but it might be a bit misleading because the types
> do not have to be class types.
 
And the choices of "Fn" and "B" are arbitrary as far as the compiler is
concerned, but idiomatic for such templates, and therefore easier for
the programmer to understand. The typename arguments in a template are
types, yet logically they are also much like arguments in a function.
So just as you might use "a" and "b" as function arguments, you use "A"
and "B" as template type arguments. To keep things clear, it is useful
to use "A" as the type for function argument "a", "B" as the template
argument for function argument "b", and so on. And "Fn" is a good
choice of name for a function type.
 
You could also have written:
 
template <typename FuncParamType, typename FirstParamType>
void abc(FuncParamType func, FirstParamType param1,
const char* param2 = "no param given")
{
func(param1, param2);
}
 
It's the same thing - it's up to you which you find clearer.
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: