Skip to content

yakom/ylib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

YLib

my personal generic C++ library. developed on-demand to use in other projects, and of course to learn - data structures, algorithms, and OS-level programming.

i would be writing my projects in C if it wasn't for several crucial features it lacks.

code style guide

note: may not by fully implemented yet.

casing :

  • types excluding functors use pascal casing.
  • variables use camel casing.
  • macros and template parameters use screaming casing.
  • in comments, capital letters are used only when specifying symbols or proper names.

underscore prefixes :

  • public symbols and function parameters have no prefix.
  • namespace-private, class-private, and class-protected symbols are prefixed by two underscores (yes, i know it's against the standard).

name lengths correlate with symbol scopes. widely-visible names must be descriptive, may be long.

development rules

  • there is a notion of a neutral type instance which symbolizes an instance from outside the domain. neutral scalars are equal to maximum values of their type. neutral object instances are created by invoking default constructors and handle only const methods. invoking non-const methods will likely cause UB.
  • a deallocate member function releases resources held by the instance and turns it into a neutral one. it's usually featured by classes that do not have access to the resources' managers, and therefore the function accepts them in order to implement the deallocation.
  • as/of functions reuse the underlying storage to give a different representation of it.
  • copy/to/from/transform functions allocate memory to hold the new representation.
  • container-specific names:
    • size : the occupied size in bytes.
    • capacity : the occupied size in storage units.
    • length : the logical size of continuous collections.
    • count : the logical size of non-continuous collections.
  • the V prefix in the name of a data structure means variable, meaning its size adjusts dynamically.

About

my personal generic C++ library

Resources

License

Stars

Watchers

Forks