Re: [QUESTION]



On 2010-08-25, parjit <nospam@xxxxxxxxxx> wrote:
Seebs wrote:
Not at all. Try putting the question into words, such as:
If I allocate something in a function, and return the pointer,
and free
it in another function, does that create a memory leak?

That would allow people to be more sure of what you were trying to do.

Actually my question was not from a negative experience, but as a result
of a discussion with someone. I argued that tho it was a bad programming
practice, it didn't necessarily create a memory leak by virtue of its
syntax. I'm still not sure if I was right or not.

I don't see what you think is a bad programming practice.

EXPLAIN your question, don't just expect us to guess it from your
sample program. What was the discussion? What do you think is "bad"
about it? What on earth do you mean by "by virtue of its syntax"? Syntax
is not what creates memory leaks. And there is no memory leak in that
code.

-s
--
Copyright 2010, all wrongs reversed. Peter Seebach / usenet-nospam@xxxxxxxxx
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
.



Relevant Pages

  • Re: Whats the best language to learn...
    ... on processors designed to run Lisp and Lisp OSes. ... sence that the language make effective use of them. ... No other programming language can do what lisp can do. ... is exactly because of its syntax. ...
    (comp.programming)
  • Re: Whats the easiest and/or simplest part of Linux Kernel?
    ... The syntax does become obtuse, unfun, cluttered, etc., but it can be done. ... because you obviously don't understand the difference between objects and object oriented programming. ... provided the tools necessary to do OOP. ... Please show how you can do inheritance and polymorphism in C. ...
    (Debian-User)
  • VB 2010
    ... So now, instead of the verbose, wasteful variable declaration syntax found in past editions, you'll be able to use the new time-saving syntax. ... To support this feature, Visual Basic requires the new "Curly Brace" syntax for loops, conditions, and Select Case statements. ... My notes must be consistent with current textbooks, thus I will need to rewrite over 500 pages of notes, and programming assignments and tests. ... Tim Patrick, on January 17th, 2010 at 5:36 pm Said: ...
    (comp.databases.pick)
  • Re: 10 ten things any good programmer can/has done?
    ... To quote Shriram Krishnamurthi, syntax ... > stress issues other than the surface syntax of some programming language. ... It means that more time has to be spend teaching the ...
    (comp.programming)
  • Re: Iteration in lisp
    ... style of programming, I have found them to be quite useful ... constructs are therefore "just an argument about trivial syntax". ... inherently create tangles of dataflow that compilers could not sort ... purely a matter of syntax, or whether it was a matter of capability. ...
    (comp.lang.lisp)