Friday, March 16, 2018

Digest for comp.lang.c++@googlegroups.com - 24 updates in 7 topics

amoremessana@gmail.com: Mar 15 10:05PM -0700

What are virtual functions? Could you please give an example?
Christian Gollwitzer <auriocus@gmx.de>: Mar 16 07:55AM +0100

> What are virtual functions? Could you please give an example?
 
A quick Google search turns up many pages with examples, including:
 
https://www.geeksforgeeks.org/virtual-function-cpp/
https://en.wikipedia.org/wiki/Virtual_function
http://www.cplusplus.com/doc/tutorial/polymorphism/
 
Christian
red floyd <no.spam@its.invalid>: Mar 16 08:43AM -0700

> What are virtual functions? Could you please give an example?
 
What textbook are you using that does not discuss them?
bitrex <bitrex@de.lete.earthlink.net>: Mar 16 06:11PM -0400

> What are virtual functions? Could you please give an example?
 
It's a function that only exists "virtually", like you have an idea for
a function that does something cool but it's the weekend and you don't
really feel much like writing code so currently you can only kinda
imagine it in your head
Ian Collins <ian-news@hotmail.com>: Mar 16 07:59PM +1300

On 03/16/2018 09:29 AM, Mr Flibble wrote:
>> read or understand the things I post. I apologize for his childish
>> intrusion into your lives.
 
> For sausages I recommend HP Sauce (a UK brown sauce).
 
Colman's mustard.
 
--
Ian.
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Mar 16 06:34AM -0700

On Friday, March 16, 2018 at 2:59:55 AM UTC-4, Ian Collins wrote:
> On 03/16/2018 09:29 AM, Mr Flibble wrote:
> > For sausages I recommend HP Sauce (a UK brown sauce).
> Colman's mustard.
 
Plochman's Mild mustard. Possibly some grilled onion and green
peppers on a freshly baked yeast role that's got some heft and
strength to it. Baked beans. German Potato Salad. And some
old staples like salty chips.
 
http://www.plochman.com/products/
 
Boy that sounds good. I may just grill out this weekend.
 
--
Rick C. Hodgin
scott@slp53.sl.home (Scott Lurndal): Mar 16 01:51PM

>>> intrusion into your lives.
 
>> For sausages I recommend HP Sauce (a UK brown sauce).
 
>Colman's mustard.
 
Beaver Brand Honey Mustard.
Gareth Owen <gwowen@gmail.com>: Mar 16 09:09PM


>> For sausages I recommend HP Sauce (a UK brown sauce).
 
> Colman's mustard.
 
In general, sure. Sausages, American mustard mixed with ketchup.
Tim Rentsch <txr@alumni.caltech.edu>: Mar 15 08:01PM -0700


>> It would be dubious to use a throw in that case.
 
> In case Alf gets confused by your posting, you need to get a better
> dictionary since that is not the meaning of the word in English.
 
Excuse my interrupting here but I feel I should raise a complaint
about this comment. It's true this characterization is not /the/
meaning of the word idiomatic, but it is /a/ meaning of the word
idiomatic. Calling a phrase "an idiomatic construction" is very
much like saying it is individualized, peculiar, or unorthodox
(which in exteme cases could be unique). As you go on to point
out, in the context the statement was made a different meaning was
intended, but that doesn't make the dictionary wrong. It's just
that idiomatic (and also idiom) is one of those words that has
multiple, contradictory meanings. The word "sanction" is another
example - it can mean approval, but it also can mean a punishment
meant to deter. "Idiom" and "idiomatic" are like that.
 
> is idiomatic to do so. You might want to think twice where it is
> counter-idiomatic however. (I put "dubious" in quotes because that
> is a counter-idiomatic use of the word in English.)
 
I notice a tendency in the programming community to use the word
"idiomatic" with a connotation of being proper, accepted, or
approved in some vague sense. That's not what idiomatic means
applied to natural languge. The word "ain't" is part of idiomatic
English. It ain't good English, and it may not be commonly used
English, but it is idiomatic English. In languages like C and
C++, almost any construction that is legal is also idiomatic, in
the sense that it is being used in earnest by (some) "native
speakers" of the language. At some level using "idiomatic" in the
ways the quoted material does is a misuse of the word.
 
In the game of Go, there is a word "joseki" that refers to one of
a (quite large) set of well-known local opening sequences. It
translates roughly as "established pattern". A key property of
joseki is that these patterns are ones high-level players are
likely to play: sequences that are known to be bad for one side
or the other are not (or are no longer) referred to as joseki.
In labelling a particular code construction "idiomatic", what
I think is meant is more like the "established pattern" property
of joseki. I hope people will reflect on this and find a better
way to express what they mean than occurs with "idiomatic".
Tim Rentsch <txr@alumni.caltech.edu>: Mar 15 09:32PM -0700

> gotos with very large spans. People in those days people were
> writing Cobol programs of many thousands* of lines, with gotos
> jumping willy-nilly all over that mass.
 
Please excuse my jumping in at the wrong point. It would have
been better to reply to an earlier posting but that isn't what
happened...
 
My take on what Dijkstra was trying to say is a bit different.
He did talk about keeping track of control flow in the presence
of goto (and, I might add, rather extensively). However I think
that was more of an explanation of why programs with goto are
difficult than why goto is harmful. I've seen the view expressed
(and I agree with it) that his main point is that goto is harmful
because those learning programming with goto as a key basic tool
(no pun intended) tend to write programs that are spaghettish
more than those who are taught to think in terms of the (now more
usual) structured constructs. In other words it isn't goto per
se that is bad, but the influence it has on the thinking of those
led to use it. I hardly ever use goto, but that isn't because I
think it's bad and try to avoid it. Rather, because of how I've
learned to write code, situations where a goto might be natural
(whatever that means) just tend not to come up. I don't feel
like any particular effort is needed to avoid using goto - it
simply falls out of how I think about programming.
 
> unstructured and goto-laden code would be much less of a problem.
> The amount of control flow insanity possible in a 50 line routine
> is inherently limited.
 
Limited? Yes. Limited enough so that it's never awful? I have
to give a No on that one. :)
 
> That's made even better when you restrict goto usage to one of a
> few idioms which are well understood, and straight-forward.
 
Here you are using "idioms" more or less as a synonym for
"patterns". When used as a count noun, "idiom" has the meaning
of "peculiar construct", not "conventional pattern". It's
different when "idiom" is used as a mass noun, but that's not the
case here, as mass nouns aren't used in the plural. "That's made
even better when you restrict goto usage to one of a few common,
straightforward, and well-understood patterns" is what I think
you mean to say. (And if it isn't then I have misunderstood you
and hope you will explain.)
bitrex <bitrex@de.lete.earthlink.net>: Mar 16 12:54AM -0400

On 03/07/2018 12:37 PM, Richard wrote:
> revealing names generally leaves you with code that is easier to
> understand and reason about and as a side benefit you get simpler
> control and data flow.
 
This "style" of code strikes me as just C in a C++ dress. Why even use
modern C++ compiler at all if this is the kind of 1976 code one wants to
write.
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Mar 16 07:20AM +0100

On 16.03.2018 05:32, Tim Rentsch wrote:
> straightforward, and well-understood patterns" is what I think
> you mean to say. (And if it isn't then I have misunderstood you
> and hope you will explain.)
 
Well that interpretation of "idiom" is not very idiomatic in programming. :)
 
 
Cheers,
 
- Alf
Robert Wessel <robertwessel2@yahoo.com>: Mar 16 03:15PM -0500

On Thu, 15 Mar 2018 21:32:14 -0700, Tim Rentsch
>(whatever that means) just tend not to come up. I don't feel
>like any particular effort is needed to avoid using goto - it
>simply falls out of how I think about programming.
 
 
One of the fundamental attributes of structured programming is the
subroutine, preferably of reasonably size.
 
I think we can debate as to exactly which aspects of structured
programming are the most important, but that's unlikely to achieve
much useful, but FWIW, my opinion is that cohesive and reasonably
sized subroutines are actually the fundamental building block of
clearly written programs. So it's really decomposition, and the skill
set to achieve it, that was missing from those monster unstructured
programs.
 
I do agree that thinking about programs in a structured way leads to
better programs (usually), but the end goal has to be something
practical, like more understandable programs. Otherwise it's just
another pointless academic exercise. In that context the lack of
structure implied by hundreds of gotos jumping willy-nilly over a
10KLOC mass of code is pretty mindboggling (if you haven't seen it,
you probably can't imaging just how bad it can be). By contrast,
while it might not be ideal, over the span of a 50 line routine, it's
a pretty minor issue. Scale is very important here.
 
Many people (pre-Dijkstra) writing those large programs understood at
least some of that, at least in an informal sense, and worked hard to
impose some sort of organization on their programs, although were
often hampered by poor tools (a lack of proper subroutines in Cobol*,
for example). Unfortunately programs have always had a tendency to
evolve, and that evolution is far too often done under time and const
constraints, and thus often involved violence to any "structure" in
the program. That's still true today, of course.
 
A similar situation are the extensive discussions of methodologies for
the development of large systems. While we can debate which
methodology we might prefer, I think we'd all agree that having *some*
plan for managing a large project is important. OTOH, if you're
writing a 1KLOC program, it just doesn't matter. Again, scale is
important.
 
So in the end, if everyone had been writing mostly ~50 line routines,
I don't think the lack of structure within those routines would have
attracted too much attention.
 
 
 
*Notwithstanding the dozens of books, papers and classes on doing
structured programming in Cobol. Until later versions of the language
this was really little better than doing structured programming in
assembler or OOP in C (both of which are obviously possible, and often
practices followed by programmers, but the tools aren't really
providing any support and that structure, or OOP, is being done
manually).
 
 
 
>> is inherently limited.
 
>Limited? Yes. Limited enough so that it's never awful? I have
>to give a No on that one. :)
 
 
You can, of course, write awful 50 line routines using only the three
basic SP control flows.
 
As I've said before, this is all about clarity, not following some
arbitrary set of rules*. I'm good with whatever makes a program
clearer. On occasion, that involves a goto. We know you *can* always
do without, but sometimes the cure is worse than the disease.
 
 
*Although in some cases arbitrary rules are a source of clarity. For
example, having a shop standard for brace placement - which placement
style you pick is pretty arbitrary**, but having everyone follow that
style, at least within a project, it quite helpful.
 
 
**So long as you pick the one obviously correct style. ;-)
 
 
>straightforward, and well-understood patterns" is what I think
>you mean to say. (And if it isn't then I have misunderstood you
>and hope you will explain.)
 
 
My experience is that those usages are pretty much interchangeable in
the field. Although I'd agree that in linguistic terms they're not.
Ian Collins <ian-news@hotmail.com>: Mar 16 07:58PM +1300

On 03/16/2018 08:47 AM, Rick C. Hodgin wrote:
 
>> As you refuse to answer such a simple question (due to the implications
>> on your belief system)
 
> I answered your question, Leigh.
 
You didn't, you posted more waffle. I simple direct question deserves a
straight forward answer.
 
--
Ian.
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Mar 16 05:21AM -0700

On Friday, March 16, 2018 at 2:58:29 AM UTC-4, Ian Collins wrote:
 
> > I answered your question, Leigh.
 
> You didn't, you posted more waffle. I simple direct question deserves a
> straight forward answer.
 
Satan tries to get us to answer questions in a box. That box has
an intent which is to provide "ammunition" for rejecting the things
which are of Christ, and of truth.
 
The truth is what the truth is, Ian. It requires teaching to lay
the proper foundation so that the true answer can be understood.
 
In my response to Leigh, I state that we have an ever-changing set
of physical laws, that our physics theories are incomplete, that
we do not yet know for certain that even what we think we know is
right. So ... we cannot know if the speed of light is (in speed)
what we think it is, or even if it is (in concept) what we think
it is. We do not have enough information to be certain.
 
--
Rick C. Hodgin
leigh.v.johnston@googlemail.com: Mar 16 06:56AM -0700

Speed of light mate.
 
#atheism
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Mar 16 07:19AM -0700

> Speed of light mate.
 
Have you looked at any other aspects of the Bible or science, Leigh?
Have you found the other gazillion instances and references which
effectively demonstrate categorically that evolution is not possible,
that design is clearly everywhere, and the like?
 
Are you hanging your entire eternity on what you happen to believe
today is a constant like the speed of light?
 
What are you going to do when you find out you were wrong? Cry
out, "Speed of light, God. Speed of light," as you're being dragged
kicking and screaming to the Lake of Fire?
 
If you're unwilling to look at the evidence, and are set on thinking
what you already think you know is true and correct, then you are
without hope.
 
--
Rick C. Hodgin
Melzzzzz <Melzzzzz@zzzzz.com>: Mar 16 02:31PM


> If you're unwilling to look at the evidence, and are set on thinking
> what you already think you know is true and correct, then you are
> without hope.
 
Rick everybody dies. No matter what you think or believe, you have to eat,
drink and breathe, of course consequence is that you have to shit and
piss as well.
 
--
press any key to continue or any other to quit...
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Mar 16 02:52PM

On 16/03/2018 14:19, Rick C. Hodgin wrote:
 
> If you're unwilling to look at the evidence, and are set on thinking
> what you already think you know is true and correct, then you are
> without hope.
 
Speed of light mate.
 
#atheism
 
/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>: Mar 16 08:29AM -0700

On Friday, March 16, 2018 at 10:52:32 AM UTC-4, Mr Flibble wrote:
> Speed of light mate.
 
John 14:6, Leigh:
 
https://www.biblegateway.com/passage/?search=John+14%3A6&version=KJV
 
6 Jesus saith unto him, I am the way, the truth, and the life:
no man cometh unto the Father, but by me.
 
You're putting your faith into something other than truth itself,
Leigh. You're resting upon something you believe, have been taught,
and may even have significantly reasonable reasons to believe, but
you're doing so at the expense of truth itself.
 
When you're eating those sausages, think on these things.
 
--
Rick C. Hodgin
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Mar 16 03:40PM

On 16/03/2018 15:29, Rick C. Hodgin wrote:
> and may even have significantly reasonable reasons to believe, but
> you're doing so at the expense of truth itself.
 
> When you're eating those sausages, think on these things.
 
Speed of light mate.
 
#atheism
 
/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."
ujjwol.optimum@gmail.com: Mar 15 09:27PM -0700

Looking for some example of stellar code for educational purpose. Any recommendations?
Jeff-Relf.Me @.: Mar 15 08:23PM -0700

Jeff-Relf.Me @.: Mar 15 07:57PM -0700

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: