Possible memory leak?

This is a discussion on Possible memory leak? within the C Programming forums, part of the General Programming Boards category; Originally Posted by CommonTater ... it is exceedingly rare to see a function definition spaced out like that... In what ...

  1. #16
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by CommonTater View Post
    ... it is exceedingly rare to see a function definition spaced out like that...
    In what sense? The only difference I see between your version and the OP's is that you put the parameters on one line and added some whitespace.

    I rarely do it, but I have seen lots of code where parameters always get one line each; there is nothing unacceptable about that (it's much more likely that advocates of the approach would poo-poo squeezing parameters onto one line, LOL).
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  2. #17
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by MK27 View Post
    In what sense? The only difference I see between your version and the OP's is that you put the parameters on one line and added some whitespace.

    I rarely do it, but I have seen lots of code where parameters always get one line each; there is nothing unacceptable about that (it's much more likely that advocates of the approach would poo-poo squeezing parameters onto one line, LOL).
    I didn't say it was unacceptable... only that it's unusual.

    When I write code, the background question is always ... "And if I have to come back to this in 5 years, will I still be able to follow it?"

    And, in case you didn't notice, I also apologized for my initial mistake in misinterpreting his code...

  3. #18
    Registered User
    Join Date
    Mar 2011
    Posts
    261
    When I write code, the background question is always ... "And if I have to come back to this in 5 years, will I still be able to follow it?"
    More importantly, as has been made apparent in THIS case, "If I want others to comment on it, will they be able to follow it?"

    That said, I believe there's actually a style standard that has the parameters listed that way. Don't recall where it might be used, or what it might be called.

  4. #19
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by CommonTater View Post
    I didn't say it was unacceptable... only that it's unusual.
    It just seemed a little devious because it is a recognizable (and IMO common) style. It would be like me seeing some newbie using an Allman style and saying, "your indentation is tedious and wastes space, no one likes that, you should do it like me", because I'd rather read stuff in K&R. In a less idiosyncratic reality, I personally may not like Allman much, but I can't claim it's bizarre or unconventional.

    No indention or random indentation is another thing.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  5. #20
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by MK27 View Post
    It just seemed a little devious because it is a recognizable (and IMO common) style. It would be like me seeing some newbie using an Allman style and saying, "your indentation is tedious and wastes space, no one likes that, you should do it like me", because I'd rather read stuff in K&R. In a less idiosyncratic reality, I personally may not like Allman much, but I can't claim it's bizarre or unconventional.

    No indention or random indentation is another thing.
    Ok you win... can we get back to helping the OP now?

  6. #21
    Registered User
    Join Date
    May 2009
    Location
    Look in your attic, I am there...
    Posts
    92
    Quote Originally Posted by CommonTater View Post
    Ok you win... can we get back to helping the OP now?
    Yikes I didn't mean to start a religious war D: . Kidding aside, the solution I posted earlier - after confirming it with some tests - seems to do the trick. Thanks again for all the help .

  7. #22
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    No worries... sometimes we do get a little carried away.

    I misread your code (that happens too)... my bad. But some people need to learn when the argument is over.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. cin memory leak?
    By jcafaro10 in forum C++ Programming
    Replies: 2
    Last Post: 01-21-2009, 01:38 AM
  2. memory leak
    By rahulsk1947 in forum C Programming
    Replies: 2
    Last Post: 11-11-2007, 12:27 PM
  3. Possible Memory Leak?
    By g1i7ch in forum C Programming
    Replies: 12
    Last Post: 05-25-2007, 01:35 PM
  4. Replies: 2
    Last Post: 09-28-2006, 01:06 PM
  5. A memory leak (I think...)
    By Stevek in forum C++ Programming
    Replies: 7
    Last Post: 03-16-2003, 02:09 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21