This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TI TM4C code variables name tradition



Hi, I am a new guy to embedded programming, and I am reading some code that provided by TI, I noticed that the name tradition in embedded world is different to the tradition in the linux world, I noticed such like 

int32_t

g_ui32IPAddress etc..

so is there a brief introduction to the naming tradition of the Embedded coding in C?

Thanks

Shan

  • Hello Shan,

    As far as I know there is no naming tradition that is specific to Embedded programming.

    TivaWare (and its predecessor StellarisWare) use Hungarian notation while naming variables, example g_ui32IPAddress which indicates a global variable (denoted by g) of type uint32_t (denoted by ui32). This allows to identify the type of the variable without having to look at the declaration of the variable.

    TivaWare also uses C99 standard. That is where you see the variable declaration such as uint32_t, instead of unsigned int.

    There is more to the Hungarian notation and C99 standard, but I hope my comments above will serve as a brief introduction to these topics, which can be expanded upon, if required.

    Thanks,
    Sai
  • Much to like in your post Sai - may I offer, "good job."   (and a "like")

    As poster appears serious - there are numerous books & articles available - becoming an efficient "investigator" (never researcher) will pay great dividends.

    Firm/I always advise those "new" to search out local schools/universities, try to find others (local to you) who share interests. Group learning and group resources is a Godsend - single efforts (Lone Ranger) retard growth & lead to "strange" conclusions...

  • Stellaris Sai said:

    As far as I know there is no naming tradition that is specific to Embedded programming.

    Agreed

    Stellaris Sai said:
    TivaWare (and its predecessor StellarisWare) use Hungarian notation while naming variables

    A system which I and many others find not only ugly and error prone in itself but error inducing. It also duplicates information available elsewhere. There are much better naming conventions. I would note that even its originator appears to be moving away from it.

    Stellaris Sai said:
    TivaWare also uses C99 standard. That is where you see the variable declaration such as uint32_t,

    Note that uint32_t and companions are not mandated by C99 (only their presence is mandated) and TIVAWare does misuse them fairly regularly. And conversely TIVAWare does not take advantage of the advantages of properly and completely defining types.

    Robert

  • Robert Adsett said:
    I would note that even its originator appears to be moving away from it.

    Might that qualify (almost) as, "Damning with faint praise?"   (or - the return of one to his/her senses?)