Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/clemedon/libft

[documented code / -pedantic -std=c89] - Libft project aims to recode some useful functions from libc as well as new functions of my choice.
https://github.com/clemedon/libft

42 42born2code 42cursus 42libft 42network 42paris 42projects 42school ansi ansic c c89 libft libft42

Last synced: about 10 hours ago
JSON representation

[documented code / -pedantic -std=c89] - Libft project aims to recode some useful functions from libc as well as new functions of my choice.

Awesome Lists containing this project

README

        


LIBFT 42


Summary
·
Usage
·
Tester
·
Tools

## Summary

First project of [42Paris](https://42.fr/) aims to create its own standard
library based on `libc` by creating certain existing and non-existing functions
from scratch. This library is also intended to be used and enriched with the
functions of our choice throughout the curriculum.

> *"It will contain a lot of general purpose functions your programs will rely
> upon."* - [Subject](https://cdn.intra.42.fr/pdf/pdf/57361/en.subject.pdf)
>
External functions: `malloc`, `free`, `write`

Code written in accordance with **42 C** coding style, **ANSI C89** compliant and entirely **documented with docstrings**.


I chose not to protect the functions from NULL pointers passed to them as a
parameter, indeed I prefer to let an explicit `SEGV` happen rather than obscure
the problem behind a `return (NULL);` making it more tedious to debug from a
superior layer of abstraction.

This choice is also observable in the `libc`. For example `STRLEN(3)`
implementation from `` will crash a program that tries to pass it a
`NULL` string instead of returning `NULL` as it would if it was protected.

## Usage

Compile the library with a simple `make -j` then add `#include "libft.h"` to
your project and compile it with these additional flags:

-I
-L
-l ft

***Makefile rules***

- `make` -- compiles get_next_line.
- `make clean` -- deletes object files.
- `make fclean` -- deletes object files and get_next_line.
- `make re` -- fclean + make.

## Tester

- **[libftTester](https://github.com/Tripouille/libftTester)**

- **[libft-unit-test](https://github.com/alelievr/libft-unit-test)**

## Tools

- **sanitizer**: `-fsanitize=address`

*Add `-g` flag when compiling with `-fsanitize=address` to print errors line numbers instead of addresses in hexadecimal.*