Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Newbies don't learn C++

Reply
Thread Tools

Newbies don't learn C++

 
 
Miles Bader
Guest
Posts: n/a
 
      01-14-2011
Jorgen Grahn <(E-Mail Removed)> writes:
> Two patterns I dislike:
> - Arguments between regulars who know the language. These too often go
> quickly from arguments to an unwillingness to understand, to trench
> warfare, and then into ad hominem attacks.


Totally agree with your post, especially the above point.

Most of the regulars here are smart and knowledgable (though of course
most have the odd blindspot or two), so the frequency with which they
fall into petty bickering at times seems almost surreal...

Has it ever really been any different though? This pattern is not
uncommon in technical newsgroups, and that's been the case as long as
I've been reading them.

-miles

--
Religion, n. A daughter of Hope and Fear, explaining to Ignorance the nature
of the Unknowable.
 
Reply With Quote
 
 
 
 
James Kanze
Guest
Posts: n/a
 
      01-14-2011
On Jan 13, 8:46 pm, Ulrich Eckhardt <(E-Mail Removed)> wrote:
> Leigh Johnston wrote:
> > On 13/01/2011 14:45, Dilip wrote:
> >> On Jan 13, 9:18 am, Leigh Johnston<(E-Mail Removed)> wrote:
> >>> A memory leak is the failure to deallocate that which was allocated
> >>> before program termination, end of story.


> >> A dynamically allocated singleton object whose lifetime extends until
> >> the application shuts down is leaking memory? You are stretching the
> >> definition of a "leak".


> > If during program termination the C/C++ runtime or the OS has to cleanup
> > a memory allocation due to a lack of a paired deallocation then that
> > memory allocation is a leak yes.


> If you want to define this term like that, so be it.


There's often a bit of arbitrary in technical definitions, so
you can't argue too much---Leigh (and apparently Microsoft, at
least in some documents) define leak in their own way. The fact
that the definition is practically useless, and doesn't relate
to the non-technical sense, make me shy away from it.

[...]
> Instead, the IMHO important property of a resource leak is
> that resources are allocated and not used any more but also
> not released.


That too, doesn't seem to relate to the non-technical meaning of
leak. If a boot leaks, it's not that a little bit of water has
gotten in, it's that water is continually entering. If
a program leaks memory, it's not that a little bit of memory is
not being freed, it's that memory is continually not being
freed.

Note that this has nothing to do with reachability. Memory can
leak even if it is reachable (which is why you can have memory
leaks in Java). With regards to your definition: if such memory
is to be used later, then you have a problem: your program
requires infinite memory in order to run.

I'll admit that my point of view is prejudiced by having worked
on a lot of long running (years) critical and semicritical
applications. Obviously, if you're not going to stop the
program, you really don't care about static destruction. On
the other hand, even a small "leak" (as I define it) will
eventually cause the program to run out of memory.

With regards to Leigh's point of view: I don't consider it
a leak, because it's a one of, and not something continual.
Ideally, I'd like to see a destructor for each constructor, but
from a practical point of view, if the cost of doing so is
a possible order of destruction problem, then it's not worth it.
Engineering is a practical activity, involving trade-offs. In
this case, I prefer a program which is sure to work over one
which meets some abstract ideal (but can fail during shutdown).

But of course, instead of discussing the technical merits of the
various solutions, some people prefer to engage in name calling.

--
James Kanze
 
Reply With Quote
 
 
 
 
gwowen
Guest
Posts: n/a
 
      01-14-2011
On Jan 14, 9:24*am, James Kanze <(E-Mail Removed)> wrote:

> That too, doesn't seem to relate to the non-technical meaning of
> leak. *If a boot leaks, it's not that a little bit of water has
> gotten in, it's that water is continually entering. *If
> a program leaks memory, it's not that a little bit of memory is
> not being freed, it's that memory is continually not being
> freed.


Yes, I'm certain that this is the time that you will convince Leigh,
despite all the evidence that he is not to be convinced, has no
interest in having his mind changed once its been made up. Let's make
one more appeal to the reasonableness and rationality on this score --
that's gone swimmingly well so far, hasn't it? Not once has
demonstrated complete indifference to the notion that other's peoples
opinions and definitions may also be valid, and he's never resorted to
name-calling - so I'm sure one last push is all that's needed to put
him over the top.

Definition of madness: doing the same thing over and over and
expecting different results.
 
Reply With Quote
 
Michael Doubez
Guest
Posts: n/a
 
      01-14-2011
On 14 jan, 13:56, Leigh Johnston <(E-Mail Removed)> wrote:
> On 14/01/2011 09:24, James Kanze wrote:
>
>
>
> > On Jan 13, 8:46 pm, Ulrich Eckhardt<(E-Mail Removed)> *wrote:
> >> Leigh Johnston wrote:
> >>> On 13/01/2011 14:45, Dilip wrote:
> >>>> On Jan 13, 9:18 am, Leigh Johnston<(E-Mail Removed)> * wrote:
> >>>>> A memory leak is the failure to deallocate that which was allocated
> >>>>> before program termination, end of story.

>
> >>>> A dynamically allocated singleton object whose lifetime extends until
> >>>> the application shuts down is leaking memory? You are stretching the
> >>>> definition of a "leak".

>
> >>> If during program termination the C/C++ runtime or the OS has to cleanup
> >>> a memory allocation due to a lack of a paired deallocation then that
> >>> memory allocation is a leak yes.

>
> >> If you want to define this term like that, so be it.

>
> > There's often a bit of arbitrary in technical definitions, so
> > you can't argue too much---Leigh (and apparently Microsoft, at
> > least in some documents) define leak in their own way. *The fact
> > that the definition is practically useless, and doesn't relate
> > to the non-technical sense, make me shy away from it.

>
> It is not practically useless; it is perfectly acceptible definition of
> what a leak actually is; you are confusing the causes of leaks with what
> a leak actually is; an object becoming unreachable due to the last
> pointer to it being "lost" can be a *cause* of leak and identifying such
> causes is important (I never said otherwise).


I am not a native english speaker but if it is a one time operation,
it should be a drop (or a splash for big objects) rather than a leak.

> Your leaking singleton is still a bag of shite.


Its real name is the Gamma Singleton IIRC.

IMHO still better than an over-engineered way of insuring correct
order of destruction or wrong usage upon exit.

--
Michael
 
Reply With Quote
 
Michael Doubez
Guest
Posts: n/a
 
      01-14-2011
On 14 jan, 14:33, Leigh Johnston <(E-Mail Removed)> wrote:
> On 14/01/2011 13:24, Michael Doubez wrote:
>
>
>
> > On 14 jan, 13:56, Leigh Johnston<(E-Mail Removed)> *wrote:
> >> On 14/01/2011 09:24, James Kanze wrote:

>
> >>> On Jan 13, 8:46 pm, Ulrich Eckhardt<(E-Mail Removed)> * *wrote:
> >>>> Leigh Johnston wrote:
> >>>>> On 13/01/2011 14:45, Dilip wrote:
> >>>>>> On Jan 13, 9:18 am, Leigh Johnston<(E-Mail Removed)> * * wrote:
> >>>>>>> A memory leak is the failure to deallocate that which was allocated
> >>>>>>> before program termination, end of story.

>
> >>>>>> A dynamically allocated singleton object whose lifetime extends until
> >>>>>> the application shuts down is leaking memory? You are stretching the
> >>>>>> definition of a "leak".

>
> >>>>> If during program termination the C/C++ runtime or the OS has to cleanup
> >>>>> a memory allocation due to a lack of a paired deallocation then that
> >>>>> memory allocation is a leak yes.

>
> >>>> If you want to define this term like that, so be it.

>
> >>> There's often a bit of arbitrary in technical definitions, so
> >>> you can't argue too much---Leigh (and apparently Microsoft, at
> >>> least in some documents) define leak in their own way. *The fact
> >>> that the definition is practically useless, and doesn't relate
> >>> to the non-technical sense, make me shy away from it.

>
> >> It is not practically useless; it is perfectly acceptible definition of
> >> what a leak actually is; you are confusing the causes of leaks with what
> >> a leak actually is; an object becoming unreachable due to the last
> >> pointer to it being "lost" can be a *cause* of leak and identifying such
> >> causes is important (I never said otherwise).

>
> > I am not a native english speaker but if it is a one time operation,
> > it should be a drop (or a splash for big objects) rather than a leak.

>
> >> Your leaking singleton is still a bag of shite.

>
> > Its real name is the Gamma Singleton IIRC.

>
> It is still a bag of shite even if it does appear in GoF. *IMO GoF is in
> error by omitting to mention when (or if) the singleton object is destroyed.


IMO rely on Java like feauture with GC. but in this case, it is the OS
that does th GC.

> > IMHO still better than an over-engineered way of insuring correct
> > order of destruction or wrong usage upon exit.

>
> You are confusing the term "over-engineered" with the term
> "correctly-engineered". *You are confusing the term "cowboy" with the
> term "professional". *If you are able to design object construction in
> an OO system you should be able to design object destruction in an OO
> system; I do agree that this may be difficult in practice given the
> existence of legacy systems and cowboy programmers.


I am talking about complexe systems that age other time or reach a
complexity where circular reference is not uncommon. Whatever your
professionalism, if you deliver a library that destroys its singleton,
you don't handle it but let the final user struggle with its order of
destruction issues.

It costs time, it costs help desk ressources, it brings defiance from
the customer or even worse delay or hard to locate bugs (since
multithreading can alter the order of initialisation/destruction issue
depending on the run).

And what do you have to justify that ? Nothing except a bunch of
principles and a definition on MSDN.

I remember windows 3.1 had problem with collecting memory (in
particular excell 2 would leave you with less memory at each run) and
I am not surprised that they pretend to defer the responsibility to
the programmer.

--
Michael
 
Reply With Quote
 
Paul
Guest
Posts: n/a
 
      01-14-2011
<snipped>
>> IMO rely on Java like feauture with GC. but in this case, it is the OS
>> that does th GC.

>
> What has Java and GC got to do with C++ singletons? Java does not have
> dtors.
>


Umm are you sure about that?


>>
>>>> IMHO still better than an over-engineered way of insuring correct
>>>> order of destruction or wrong usage upon exit.

<snip>, if you deliver a library that destroys its singleton,
>> you don't handle it but let the final user struggle with its order of
>> destruction issues.

>
> Garbage; I use Meyers Singletons with no ill effects. Meyers Singleton
> objects are destroyed in a deterministic fashion.
>
>>
>> It costs time, it costs help desk ressources, it brings defiance from
>> the customer or even worse delay or hard to locate bugs (since
>> multithreading can alter the order of initialisation/destruction issue
>> depending on the run).

>
> Garbage; I use Meyers Singletons in a multi-threaded system with no ill
> effects. It is not impossible to ensure that the lifetime of a
> singleton is greater than the lifetime of any threads that use it; I
> have presented a thread-safe version of Meyers Singleton in this
> newsgroup the other month.
>
>>

Is there an echo in here?


<snip...... snip>
 
Reply With Quote
 
Jorgen Grahn
Guest
Posts: n/a
 
      01-22-2011
On Fri, 2011-01-14, Miles Bader wrote:
> Jorgen Grahn <(E-Mail Removed)> writes:
>> Two patterns I dislike:
>> - Arguments between regulars who know the language. These too often go
>> quickly from arguments to an unwillingness to understand, to trench
>> warfare, and then into ad hominem attacks.

>
> Totally agree with your post, especially the above point.
>
> Most of the regulars here are smart and knowledgable (though of course
> most have the odd blindspot or two), so the frequency with which they
> fall into petty bickering at times seems almost surreal...
>
> Has it ever really been any different though? This pattern is not
> uncommon in technical newsgroups, and that's been the case as long as
> I've been reading them.


No technical newsgroup is 100% friendly, and c.l.c++ is not close to
being the worst one (comp.lang.c is worse, for example).

But yes, I think it has gotten worse here.

/Jorgen

--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
 
Reply With Quote
 
Öö Tiib
Guest
Posts: n/a
 
      01-23-2011
On Jan 23, 3:11*am, Sherm Pendley <(E-Mail Removed)> wrote:
> Miles Bader <(E-Mail Removed)> writes:
> > Jorgen Grahn <(E-Mail Removed)> writes:
> >> Two patterns I dislike:
> >> - Arguments between regulars who know the language. These too often go
> >> * quickly from arguments to an unwillingness to understand, to trench
> >> * warfare, and then into ad hominem attacks.

>
> > Totally agree with your post, especially the above point.

>
> > Most of the regulars here are smart and knowledgable (though of course
> > most have the odd blindspot or two), so the frequency with which they
> > fall into petty bickering at times seems almost surreal...

>
> I think what we have here is a group of people who are accustomed to
> being the smartest in the room, whose knowledge and experience earns
> them respect and deference from their coworkers. But here, they find
> themselves among peers, and for some it may be a difficult adjustment
> to make.
>
> If you take a bunch of alpha dogs and put them in the room together,
> there *will* be a lot of growling and snapping, as they sort out a new
> pecking order among themselves.


Lot of regulars of any usenet group are also veterans of large flame-
wars of old. Usenet has been more than 2 decades. Now the newer, more
fancy, better organized forums and wikis attract new members better
and are taking over. Idiocy and spam in new communities gets down-
voted and deleted ... freedom of voice is gone. It is perhaps normal
that old warriors are now bit grumpy.
 
Reply With Quote
 
Alf P. Steinbach /Usenet
Guest
Posts: n/a
 
      01-23-2011
* Öö Tiib, on 23.01.2011 14:08:
> On Jan 23, 3:11 am, Sherm Pendley<(E-Mail Removed)> wrote:
>> Miles Bader<(E-Mail Removed)> writes:
>>> Jorgen Grahn<(E-Mail Removed)> writes:
>>>> Two patterns I dislike:
>>>> - Arguments between regulars who know the language. These too often go
>>>> quickly from arguments to an unwillingness to understand, to trench
>>>> warfare, and then into ad hominem attacks.

>>
>>> Totally agree with your post, especially the above point.

>>
>>> Most of the regulars here are smart and knowledgable (though of course
>>> most have the odd blindspot or two), so the frequency with which they
>>> fall into petty bickering at times seems almost surreal...

>>
>> I think what we have here is a group of people who are accustomed to
>> being the smartest in the room, whose knowledge and experience earns
>> them respect and deference from their coworkers. But here, they find
>> themselves among peers, and for some it may be a difficult adjustment
>> to make.
>>
>> If you take a bunch of alpha dogs and put them in the room together,
>> there *will* be a lot of growling and snapping, as they sort out a new
>> pecking order among themselves.

>
> Lot of regulars of any usenet group are also veterans of large flame-
> wars of old.


Right (at least, I've been involved in many a flame war, including really really
dirty ones involving legendary trolls such as Erik Naggum (RIP) -- he did on
several occasions suggest that people commit suicide, and did, for example,
describe my parents as alcoholics, so on, but very technically bright, nearly
always technically correct, and reportedly very nice person in private).


> Usenet has been more than 2 decades. Now the newer, more
> fancy, better organized forums and wikis attract new members better
> and are taking over.


Right.


> Idiocy and spam in new communities gets down-
> voted and deleted ...


No, sorry. At least on StackOverflow herd-voting is quite common. It results in
incorrect answers often being designated as "the solution" to a question; lots
of dis-information being spread around.

And sometimes it results in the only correct answer being downvoted out of
existence.

It's just the tragedy of the commons.

I think it could be somewhat alleviated if these new sites supported real
discussions, as on Usenet.

But again, to take StackOverflow as example, all the zillion+1 requests to make
it less impossible to have structured discussions, have been denied, for the
reason that discussions are regarded as undesirable on the site.


> freedom of voice is gone. It is perhaps normal
> that old warriors are now bit grumpy.


Yes.


Cheers,

- Alf

--
blog at <url: http://alfps.wordpress.com>
 
Reply With Quote
 
SG
Guest
Posts: n/a
 
      01-23-2011
On 23 Jan., 15:52, "Alf P. Steinbach /Usenet" wrote:
> [...]
> > Idiocy and spam in new communities gets down-
> > voted and deleted ...

>
> No, sorry. At least on StackOverflow herd-voting is quite common. It results in
> incorrect answers often being designated as "the solution" to a question; lots
> of dis-information being spread around.


Aren't you exaggerating this a little? Disinformation eventually gets
downvoted in many cases from what I can tell. Users that know some
answer is wrong can comment and explain its flaws. So, eventually,
this is reflected in the votes.

Cheers!
SG
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Some information for the one who decided to learn C++, and now wantsto learn at least a bit of C? Alexander C Programming 20 09-11-2010 01:04 AM
How we recognize newbies as newbies Alf P. Steinbach C++ 31 08-21-2007 05:12 PM
Learn the language before you learn the GUI. CoreyWhite C++ 1 03-31-2007 08:56 PM
Re: Newbies? - Usenet don't need no steenking newbies! =?iso-8859-1?Q?=B1?= Digital Photography 2 07-17-2004 02:26 PM
newbie question: should I learn TKinter or skip it and learn more advanced toolkit? Porky Pig Jr Python 3 05-12-2004 08:58 AM



Advertisments