Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 164485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T11:45:09+00:00 2026-05-11T11:45:09+00:00

Do you know how can I make splint ignore where I declare my variables?

  • 0

Do you know how can I make splint ignore where I declare my variables?

I know that the old school c tells you to declare variables right at the beginning in every function, but since I am a bad person I like to declare things close to where I use them. A good example is to put int i; right before the for(i=0;…).

Let’s take a very simple example

#include  <stdio.h> int main() {     printf('Hello splint test\n');      int i;     for(i=5;i>0;i--)     {         printf('%2d...\n',i);     }      return 0; } 

Here splint and most old c compilers would like to move int i; up one line, or to put {} round the declaration and the for loop.

And now to the question, how do I turn off this check? But keep the other checks that is good?

Thanks Johan


Note 1: I already use gcc warnings(see below) as a first line off defence, and valgrind as the second. But I’m thinking about adding splint to my list of things that could control my stupidity 😉 But this check is just annoying,

The gcc warnings I use: -Wall -W -Wextra -Wconversion -Wshadow -Wcast-qual -Wwrite-strings -Werror

Note 2: I know about the potential portability problems that could come from that bad behaviour. But I feel that it increases readability, aka not needing to jump up and down to search for this type off declarations is more valuable (and this we can discuss in another thread).


Update: A little more information, I put the above code in a file called main.c. Platform used is Ubuntu 8.04 and gvim as editor, and this is the output from splint when I run it:

splint +gnuextensions main.c Splint 3.1.1 --- 03 Nov 2006  Command Line: Setting +gnuextensions redundant with current value main.c:8:8: Parse Error. (For help on parse errors, see splint -help                  parseerrors.) 

And this opens up 2 more questions that I did not think about before.

  1. ‘redundant with current value’, what current value?

  2. Why is it a parse Error and not a warning?


Update:: There is a posibility to patch splint to support this problem, I have not tried this but yet but I think that it is the solution.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T11:45:09+00:00Added an answer on May 11, 2026 at 11:45 am

    Here’s a patch: http://www.cs.virginia.edu/pipermail/splint-discuss/attachments/20080718/52cc25f6/attachment.obj

    You should be able to feed that through patch -p2 if you’re in the splint/src directory, and then it should just rebuild.

    That’s from this email: http://www.cs.virginia.edu/pipermail/splint-discuss/2008-July/001190.html

    (Sorry about the spacing on that.)

    You’ll find that eventually if you follow the thread starblue linked to, but I thought I’d jump to the end for you.

    Splint seems to be without a maintainer right now, unfortunately. I’d consider stepping up and doing some more if I weren’t so busy.

    Jake

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 255k
  • Answers 255k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer See this blog post (and the one it links to)… May 13, 2026 at 10:26 am
  • Editorial Team
    Editorial Team added an answer Looks like this was some weird issue with the NHContrib… May 13, 2026 at 10:26 am
  • Editorial Team
    Editorial Team added an answer Try the following command: mysqladmin -h[hostname/localhost] -u[username] -p[password] drop [database] May 13, 2026 at 10:26 am

Related Questions

http://img136.imageshack.us/img136/3508/texturefailz.png This is my current program. I know it's terribly ugly, I found two
I recently started work on a personal coding project using C++ and KDevelop. Although
I am trying to make a 'brush' tool in AS3 (pure, not Flex) which
I need to make a DirectX 3D mesh at run time using Managed DirectX

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.