Coder Social home page Coder Social logo

cmacro-better's Introduction

cmacro-better

This is severe abuse of the preprocessor.

The goal was to take cfloat-better(another project of mine), and allow it to have the ability to serve not only the float type for values stored within it's array, but other types as well.

To this end, mimicking templating with the preprocessor in hindsight was a reasonable idea.

This can be disputed.

SIDENOTE: It was unintentionally also capable of working with structures, so to keep that compatibility, fa_get_sum was ommited.

All other functions from cfloat-better have now been implemented in cmacro-better, and follow the pattern:

  • <normal-function-name>_<name>(<normal args, but types will be those of value*>);

There is an anomaly in this pattern, where if the function name would end with "_arr", it is omitted here.

name and value are parameters passed to the macro MA_DEFINE_BETTER_STRUCT, which is the holy macro that creates the functions and structure that you'd be using.

MA_DEFINE_BETTER_STRUCT(value, name);

  • value is the type, for example: an integer array would have this value as int, and a float array as float.
  • name is the name of the internal structure used in the lib, say better_int. it influences the names of the functions(as I have shown before), and repeating this wouldn't end well at compile time.

END NOTE/S: The supplied makefile compiles the general.c example, but due to the extreme simplicity of the makefile, modification to allow compilation of the other supplied examples would be rather easy.

cmacro-better's People

Contributors

mynameajeff avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.