Lint

Discussion in 'iOS Development' started by Cyanidepoison, Apr 19, 2009.

  1. Cyanidepoison

    Cyanidepoison Active Member

    Joined:
    Jan 18, 2008
    Messages:
    1,076
    Likes Received:
    2
    Have any of you found any good Lint programs for Objective-C? I tried running it through splint, but it just complained about the #import vs. #include (since it doesn't even know what #import is).

    For those of you who are wondering, lint programs are like turning your compiler on with pretty much every possible warning plus a bunch more that compilers don't care about.


    I spent three hours tracking down a bug that stemmed from me using the assignment operator instead of equality. Lint on a C program would have caught that immediately.
  2. SkylarEC

    SkylarEC Super Moderator Emeritus Staff Member

    Joined:
    Sep 19, 2007
    Messages:
    6,642
    Likes Received:
    129
    Why not use -Wall and -Werror? If you use = where you should use ==, that's totally your own fault. If you spend hours tracking down that bug, then you must learn better pactices with a debugger, or start stepping through your code line by line (while it's running).

    Yes, we all make that mistake, it happens. But you should not spend hours tracking it down.
  3. Cyanidepoison

    Cyanidepoison Active Member

    Joined:
    Jan 18, 2008
    Messages:
    1,076
    Likes Received:
    2
    Compilers do not check the kind of logic errors and security flaws I'm talking about.
  4. SkylarEC

    SkylarEC Super Moderator Emeritus Staff Member

    Joined:
    Sep 19, 2007
    Messages:
    6,642
    Likes Received:
    129
    It seems to me that relying on a third party to the compilation process is a recipe for disaster, no?

    Under different circumstances, I could use if (x == 4) or if (x = 4). Depending on whether I want to test equality or assignment.

    if ([someString isEqualToString:someOtherString]) or if (someString = someOtherString);

    I don't know about anyone else, but there's no way I'll trust a machine correct my logic. Although your opinion is obviously different, and isn't wrong by any means. It's just that I don't agree with it. I do hope you find what you;re looking for.
  5. Cyanidepoison

    Cyanidepoison Active Member

    Joined:
    Jan 18, 2008
    Messages:
    1,076
    Likes Received:
    2
    Lint isn't part of the compilation process. It just processes your code and spits out more errors that you may want to look into.

    I realize a healthy session with GDB would have solved this issue, but I was sure my errors were in a completely different realm. It was pretty stupid.
  6. SkylarEC

    SkylarEC Super Moderator Emeritus Staff Member

    Joined:
    Sep 19, 2007
    Messages:
    6,642
    Likes Received:
    129
    I still don't care. There's no way I'm trusting it. A machine is only as good as the person who built it.

    Plus, when they finally rise to take over the planet and wage all out war on humanity, I don't want them to know my damn secrets.

Share This Page