NewAPI/Conventions

From Allegro Wiki
Jump to: navigation, search

Naming conventions

See this long rationale an Allegro developer wrote some time ago, which is still what we want to adhere to for the A5 API. Basically:

  • Function names are prefixed with al_.
  • Function names use underscores.
  • Function names are all lowercase.
  • Function names follow verb noun order.

So, to name a function, we name it how you would actually say it. E.g. for a function to draw a line, we name it al_draw_line.

Data types

Since long can have different bit widths on different platforms, there is not much point using it in the API. Therefore, we keep using int. If int has not enough bits in a certain situation, then int64_t and similar fixed width or minimum width types are used.

For truth values, bool and true/false (as defined by C99 and stdbool.h) are used, instead of Allegro 4's TRUE/FALSE macros.