libkernaux/CONTRIBUTING.md

1.4 KiB

Common

  • Add your name to COPYING.
  • If you change the behavior (even just fix a bug) of libkernaux (stable) or libc, add a record to ChangeLog.

C language

  • Create typedefs with the names of related structs. Use this name with a prefix struct to declare the data itself, withoth the prefix to declare a pointer or an array:
typedef struct FooBar { int car; } *FooBar;

static struct FooBar FooBar_create();
static void FooBar FooBar_init(FooBar foobar);

static void FooBar_do_something(FooBar foobar);

// Initialize:
struct FooBar foobar = FooBar_create();
// or
struct FooBar foobar;
FooBar_init(&foobar);

// Use:
FooBar foobar_ptr = &foobar;
FooBar_do_something(&foobar);
typedef struct FooBar { int car; } FooBar[1];

static struct FooBar FooBar_create();
static void FooBar FooBar_init(FooBar foobar);

static void FooBar_do_something(FooBar foobar);

// Initialize:
FooBar foobar = { FooBar_create() };
// or
FooBar foobar;
FooBar_init(foobar);

// Use:
FooBar_do_something(foobar);

Python

Nothing here yet.

Ruby

Matz's Ruby interpreter

Use RuboCop. See bindings/ruby/.rubocop.yml

mruby

Use RuboCop. See bindings/mruby/.rubocop.yml

Rust

Use rustfmt and Clippy. See bindings/rust/rustfmt.toml