Remark #1599: Declaration hides variable "variable name"

Code creates a local version of the variable that exists in the larger block.

Example #1: from Linux-2.6-rc3 file lib/crc32.c

    184 u32 __attribute_pure__ crc32_be(u32 crc, unsigned char const *p, size_t len)
    185 {

    186 - 199 ....

    200                         u8 *p = (u8 *)b;

Local variable p at line 200 creates a local variable p that masks the one passed to the function.

Example #2: from Linux-2.6-rc3 drivers/scsi/aic7xxx/aic79xx_pci.c

    285         struct scb_data *shared_scb_data;
    286         u_int            command;
    287         uint32_t         devconfig;
    288         uint16_t         subvendor;
    289         int              error;

    290 - 326 ....

    327         if ((ahd->flags & (AHD_39BIT_ADDRESSING|AHD_64BIT_ADDRESSING)) !        = 0) {
    328                 uint32_t devconfig;

How to resolve:

Renaming variable in internal scope is most likely course of action.  Caution must be taken to make sure this doesn't cause problems with the code.

SourceForge.net Logo