[previous] 1516 [next] Different files are being used which have similar filenames 'filename', but with different case.
CMA maintenance checks

As with type, object and function names, the name used for a file should also help document the purpose of that file.

If two files in a project share the same name it may be that the names are not descriptive enough leading to extra maintenance effort.

Where a filename differs in case only, some platforms will treat the filenames as distinct. This however will not be portable and on platforms where filenames are not case sensitive, the wrong file may be found causing a compile failure, or worst case the code will continue to build but will have different semantics.

Example:

// x.h
struct X
{
};



// bar.h        // #1
#include "x.h"
void f(X, int);



// BAR.h        // #2
#include "x.h"



// main.cc
#include "bar.h"

void f(X, char);

int main ()
{
  X x;
  f (x, 1);    // Which 'f'
}


No MISRA-C:2004 Rules applicable to message 1516


See also:

QA·C Source Code Analyser 8.1
MISRA-C:2004 Compliance Module 3.2
© 2012 Programming Research.
www.programmingresearch.com
Personality Groups | Glossary | Message Index | MISRA-C:2004 Rule Index Contents