Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Name of C/C++ stdlib naming convention?

I wonder if the naming convention used in C/C++ standard libraries has a name, or at least a cheat-sheet where I can lookup the rules. E.g.

push_back    -- underscore used setstate     -- but not used here! string::npos -- when to use abbreviations? fprintf ... 

Does the naming convention used in the C/C++ standard libraries have a specific name?

like image 764
Khaled Alshaya Avatar asked Nov 14 '09 13:11

Khaled Alshaya


People also ask

What is the naming convention in C?

The first character of the name should be a letter and all characters (except the period) should be lower-case letters and numbers. The base name should be eight or fewer characters and the suffix should be three or fewer characters (four, if you include the period).

Does C use CamelCase or Snakecase?

Classic C doesn't use camel-case; I've written code in camel-case in C, and it looks weird (so I don't do it like that any more). That said, it isn't wrong - and consistency is more important than which convention is used.

What is naming convention and example?

Naming-convention definitionA collection of rules followed by a set of names which allow users to deduce useful information, based on the names' character sequence and knowledge of the rules followed; such as Manhattan's East-West streets being called "Streets" and its North-South streets being called "Avenues". noun.

What is the variable naming convention in C C++ called?

C++ uses CamelCase as a practice for writing names of methods, variables, classes, packages, and constants. CamelCase is a naming convention where a name is formed of multiple words that are joined together as a single word with the first letter of each of the word capitalized.


1 Answers

C/C++ uses the famous make-stuff-up-as-we-go-along naming convention. In general, the only consistent things you can say about the C/C++ standard library naming convention is that it doesn't use camel case (except for C++ STL template typenames), it uses lower-case class and function names, and (sometimes) uses underscores to separate words. But the usage of underscores is more of a C++ thing; C in particular tends to abbreviate words, e.g. strlen, memcpy. This is probably a result of the tendency to use very terse names for things in the early days of UNIX.

like image 158
Charles Salvia Avatar answered Sep 18 '22 22:09

Charles Salvia