Click on image to see enlargment

PC-lint/FlexeLint Output | Reference Manual Explanation | Home

            bug767.mm

@module schedule.cpp
1     #include "menu.h"
2     int main()
3         {
4         #define MpH 60              // time is always in minutes
5         int start_time = 15 * MpH;  // 3:00 PM
6         for( int i = 0; Menu[i].name; i++ )
7             {
8             int t = start_time - Menu[i].preptime;
9             printf( "start %s at time %d:%02d\n",
10                Menu[i].name, t/MpH, t%MpH );
11            }
12        return 0;
13        }

@module menu.cpp
1     #include "menu.h"
2     #define MpH 6
3     struct Item Menu[] =
4       { { "turkey", 3.5 * MpH },
5         { "potatoes", 1.5 * MpH },
6         { "peas", 25 },   /* etc. */
7         { 0, 0 } };

@header menu.h
1     #include <stdio.h>
2     struct Item { const char *name; int preptime; };
3     extern struct Item Menu[];

Aunt Mildred is in the process of automating her Thanksgiving Dinner preparations but she has made one little flaw in her multi-module program that will, if not corrected, guarantee a late dinner.


bug767.mm lint Output

=== Multiple Modules: bug767.mm

--- Module:   schedule.cpp (C++)

--- Module:   menu.cpp (C++)
                _
    #define MpH 6
menu.cpp(2) : Info 767: macro 'MpH' was defined differently in another module (line 4, file schedule.cpp)
                              _
      { { "turkey", 3.5 * MpH },
menu.cpp(4) : Warning 524: Loss of precision (initialization) (double to int)
                                _
        { "potatoes", 1.5 * MpH },
menu.cpp(5) : Warning 524: Loss of precision (initialization) (double to int)

Reference Manual Explanation


767    macro 'Symbol' was defined differently in another module (Location)  -- Two macros processed in
       two different modules had inconsistent definitions.


If you have comments or questions about this bug, please post them to our   Discussion Forum


Previous Bug - Bug #534 - October 2012

Use our Interactive Demo to Run FlexeLint on our Bugs of the Month

PC-lint/FlexeLint - Product Overview

Home | Contact | Order

PC-lint and FlexeLint are trademarks of Gimpel Software
Copyright 2012, Gimpel Software, All rights reserved.