TICS Coding Standard Viewer 
TIOBE Software Quality Framework
Print-friendly version
©TIOBE Software www.tiobe.com
 
C++ Coding Standard
Search

Rule:  NAM#013

This rule is Obsolete
Synopsis:Prefixes for exported functions, structures, enumerations and macros consist of unit id and optionally module id
Language:C++
Severity Level:10
Category:Naming


Description:

Functions, structures, enumerations and macros, which are exported from a unit, are named as follows:

type <unit id><name>(parameters)
struct <unit id><name>
enum <unit id><name>
#define <unit id><name>

or when exported from a module, as follows:

type <unit id><module id><name>(parameters)
struct <unit id><module id><name>
enum <unit id><module id><name>
#define <unit id><module id><name>

An example is given for a function used in the Infra unit. This function can be named like:

void InfraTrace(const Cstring& rsText);

for an enumeration also the enum values should be prefixed:

enum InfraPCIConnectStatus
{
    INFRA_PCI_CONNECT_STATUS_ALREADY_CONNECTED,
    INFRA_PCI_CONNECT_STATUS_SUCCESSFUL,
};

A macro that is exported must have a unit or module prefix, as in:

#define INFRA_PCI_MAX_BUFFER_LENGTH  1000
#define INFRA_MAX(p1, p2)           ((p1) > (p2)) ? (p1) : (p2)