lclint-interest message 89

From Thu Jul 18 15:22:08 1996
X-Mailer: exmh version 1.6.7 5/3/96
Subject: Initialising arrays in loops
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Date: Thu, 18 Jul 1996 16:11:41 +0100
From: Mike Ellis 


Can anyone out there help with this please?

% cat lclint.c
int main(void)
  int array[4];
  int count;

  for (count = 0; count <= 3; count++)
      array[count] = count;

  /* initialised array[] */
  return array[0];
% lclint lclint.c
LCLint 2.1b --- 15 May 96
lclint.c: (in function main)
lclint.c:12,10: Array element array[0] used before definition
  An rvalue is used that may not be initialized to a value on some execution
  path. (-usedef will suppress message)
Finished LCLint checking --- 1 code error found

Obviously,  what we would like to do is have the comment carry some weight 
- I "tell" LCLint that array[] has been initialised.  Is there any way of 
achieving this?



      Mike Ellis,  Research and Development Engineer,  BBC R & D  DDI:(+44) 1737 836663   Fax:(+44) 1737 836667
BBC R&D, Kingswood Warren, Woodland Way, Tadworth, Surrey KT20 6NP, UK
Any opinions expressed are my own and may not reflect those of the BBC 

Previous Message Next Message Archive Summary LCLint Home Page David Evans
University of Virginia, Computer Science