Version 7.0
Copyright © 2021 Lowell D. Thomas
APG
… an ABNF Parser Generator
Hungarian Notation

Hungarian Notation

Hungarian notation has its pros and cons. It is not necessarily self-consistent and the compiler, of course, pays no attention to it. It is a matter of preference but I have found it very useful for the development of APG and have followed the conventions below fairly consistently. For variables this notation indicates the variable type, for functions it indicates the return value type.

The basic types use the prefixes:

prefix - type             - example
c      - char             - char cChar;
ac     - achar            - achar acAlphabetChar;
ui     - unsigned int     - aint uiApgInteger; uint32_t uiUnicode;
b      - abool            - abool bIsTrue(){return 1;}
v      - void             - vNoReturn(){};
s      - struct/union     - struct {aint uiValue;} sMyStruct;
pfn    - function pointer - void (*pfnMyFunc)(void);

A p is added to indicate a pointer and an a is added to indicate an array. For example:

prefix - type
cp     - char* cpString = "string";
ca     - char caChar[5] = {65,66,67,68,69};

The pre-prefix s_is used for static, globals within a file.

static char* s_cpCommonMsg = "This message is used a lot.";

Additional Conventions

Macros are always in upper case with underscores.

#define MY_DEFINE 1

Type definitions are lower case with underscores

typedef struct{aint uiValue;} my_special_type;

Variables and functions are camel case with Hungarian notation for the variable type or function return type.

aint uiMyFavoriteVariable = 1;
achar* acpMyFavoriteFunc(achar* acpCharacters){
    // do something to the characters
    return acpCharacters;
}
APG Version 7.0 is licensed under the 2-Clause BSD License,
an Open Source Initiative Approved License.