STL Memory leak?

J

James Kanze

But anyways, I think that if any programmer reads the word
"List", the first thing thar comes in his mind is the linked
list.
Actually, and I'm far from a newbie, I didn't get your
illustration because I *didn't* think of "optionList" as
specifying that it was a std::list<>. I didn't think of that
until Kanze said something about it. I just thought, "Oh, a
list of options," in the abstract sense.

I mentionned it because Arne did.

I wonder if there isn't a linguistic question involved here. I
think you're a native English speaker, and I grew up as one,
even if it's been years since I last used English regularly.
The "everyday" sense of list is the first which comes to mind to
us. I don't think Arne is a native English speaker. (He's
posting from a .de address, and his name sounds rather
German---although it wouldn't surprise me if some Americans had
the same name.) His English is obviously very good, but he
probably doesn't have the same feeling for the language a native
speaker would. If most of his use of English is technical
English, in a C++ environment, then his point of view is very
understandable. When I worked in Germany, "List" would have
generally been understood to refer to a concrete type: std::list
in C++, java.util.ArrayList in Java, etc. And I would have
called the variable in question "optionsVerzeichnis", and not
"optionList".
 
J

Jorgen Grahn

[style rules]
As an absolute rule (which requires compelling justification to
violate), you should be consistent. If you do use "dest" in one
place, rather than "destination", then you should use it
everywhere---there should be no "destination" (nor "dst") in the
code.

That's actually the rule I hate and fear the most. Applied to real
life, it would mean I'd kiss the hand of everyone I meet, because
that's what I'll do if I meet the Pope.

If you intend "consistent" to mean "in similar situations, do things
the same way", then I'll agree strongly. Code which switches
indentation style, switches "voice" in the comments and naming etc /at
random/ is not fun to read. It tends to have other problems as well --
it's a sign the programmer has lost control over the code.

Unfortunately, such fine distinctions probably do not end up in style
guidelines :-(

/Jorgen
 
J

James Kanze

@gmail.com> wrote:
[style rules]
As an absolute rule (which requires compelling justification
to violate), you should be consistent. If you do use "dest"
in one place, rather than "destination", then you should use
it everywhere---there should be no "destination" (nor "dst")
in the code.
That's actually the rule I hate and fear the most. Applied to
real life, it would mean I'd kiss the hand of everyone I meet,
because that's what I'll do if I meet the Pope.

Or that you shouldn't kiss the hand of the Pope:).

Seriously, that's a bad analogy. The correct analogy would be
that every time I use a word in something that I write, I spell
it identically. Which in fact, I do.
If you intend "consistent" to mean "in similar situations, do
things the same way", then I'll agree strongly. Code which
switches indentation style, switches "voice" in the comments
and naming etc /at random/ is not fun to read. It tends to
have other problems as well -- it's a sign the programmer has
lost control over the code.

I think there typically is a bit of tolerance for local
variables within a function. Other than that, however, no. Any
given name should always be spelled the same way (and I'm not
that convinced that the tolerance within a function is
necessary).
 
J

Jorgen Grahn

@gmail.com> wrote:
[style rules]
As an absolute rule (which requires compelling justification
to violate), you should be consistent. If you do use "dest"
in one place, rather than "destination", then you should use
it everywhere---there should be no "destination" (nor "dst")
in the code.
That's actually the rule I hate and fear the most. Applied to
real life, it would mean I'd kiss the hand of everyone I meet,
because that's what I'll do if I meet the Pope.

Or that you shouldn't kiss the hand of the Pope:).

Come to think of it, I tend to avoid the Pope when he is around.
Seriously, that's a bad analogy. The correct analogy would be
that every time I use a word in something that I write, I spell
it identically. Which in fact, I do.

(But you probably adapt your style and choice of words for the
audience.)

OK it was a bad analogy for choice of names, perhaps. I understood
your consistent naming as a concrete example of a general "always be
consistent" rule.

/Jorgen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Memory Leak Detection 11
Memory Leak detection 1
memory leak 4
Does this function leak memory? 2
Memory leak in string assigment 5
Memory Management Question 8
Does this constitute a memory leak? 8
Memory Leak 5

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,608
Members
45,245
Latest member
Evelyne64L

Latest Threads

Top