View Poll Results: What do you think of my code?

Voters
1. You may not vote on this poll
  • Easy to read, good standard C

    1 100.00%
  • Your code sucks

    0 0%

Thread: Style comments please

  1. #31
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by quzah View Post
    It's ugly. I don't like ugly code. Besides, you can just grep the name of a function and grep will tell you what line in what file it is on anyway, so you don't have to force it onto its own line. I know why it is done, it's just ugly, and I've never had any reason to do it that way.
    You might say they're grepping lazy about it...

  2. #32
    Registered User
    Join Date
    Sep 2007
    Posts
    1,012
    Quote Originally Posted by quzah View Post
    It's ugly. I don't like ugly code. Besides, you can just grep the name of a function and grep will tell you what line in what file it is on anyway, so you don't have to force it onto its own line. I know why it is done, it's just ugly, and I've never had any reason to do it that way.
    If you don't have it on its own line, you can't grep for just the definition; you'll find function calls, as well. Having it on its own line makes it as easy as prefixing a ^ to the function name when searching.

    And again, if you don't do it, that's fine with me. I'm not claiming it's necessary for everybody.
    Why do you keep saying "well you have to load it into your IDE to know!" - What do you think grep is doing? It's loading each file to find out what you asked it to find. It's no different than loading them and having your IDE find them for you.
    Efficiency reasons. I don't have to take the time to start an IDE and wait for it to actually parse the source code (since an IDE is able to know what a struct is, a function, a class, etc, it has to include a C parser, or at least a subset of one). If all I want is to find the definition of a function, grep is faster for me. This happens in code I'm not frequently in touch with. I generally keep a tags file around in my projects.

    Using grep in these circumstances fits my workflow better. Formatting source files like this has minimal cost (no size difference on Unix systems, so the only difference is vertical space) and there is a gain in a specific area for me. Once more: if you do things a different way, it doesn't matter to me; nowhere have I tried to convince anybody to switch to this method. Since you claim to know the reason why source is formatted this way, I'm not sure what the issue is, unless you're attempting to tell me I shouldn't like source that's formatted in this particular style.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need some comments
    By shaizy in forum C Programming
    Replies: 0
    Last Post: 05-26-2006, 01:59 AM
  2. comments please...
    By kiranck007 in forum C Programming
    Replies: 4
    Last Post: 02-01-2006, 06:47 AM
  3. reinterpret_cast, C-style cast or function-style cast
    By blight2c in forum C++ Programming
    Replies: 3
    Last Post: 05-14-2002, 10:07 PM
  4. c-style string vs. c++-style strings
    By Mbrio in forum C++ Programming
    Replies: 3
    Last Post: 02-10-2002, 12:26 PM
  5. how do I extract a style from a DWORD style
    By zMan in forum Windows Programming
    Replies: 1
    Last Post: 01-17-2002, 10:09 AM