ARMmbed / ARMmbed/compiler-polyfill

Aspirations for this module

Open
#7 1 comment 0 reactions 0 assignees View on GitHub
mirrored
Dominant language
C
Stars
0
Forks
4
PR merge metrics
No merged PRs in 30d

Description

This module intends to make it easier to write compiler-agnostic code by providing consistent definitions across compilers.

The `__deprecated` etc attributes currently defined by this module are a small step towards that, but what's possible in these definitions is actually quite limited.

Currently known issues:
- `__double_underscored_names` are technically reserved for compiler/system use
- if two versions of an attribute exist, one with arguments and one without, the preprocessor cannot distinguish between them (we'd need empty brackets after the version with no arguments)

Possible improvements:
- use _polyfill_xxx names in addition to and eventually instead of the current ones (this has the disadvantage of being less standard for things like __unused which are already defined in many environments)
- always requires brackets, (e.g. `__unused()`) and define function-like macros that could, for example, handle variable numbers of arguments.

These are still far from perfect though.

In the long run, this module could possibly define a custom preprocessing script to be run over code, instead of relying on the limited C preprocessor. This seems like it might be the best long-term solution.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing the module's current __deprecated and related attribute definitions, then compare the listed preprocessor limitations with compiler behavior. The issue describes several possible directions, including renamed macros, required brackets, and a custom preprocessing script, but it does not define a chosen approach or acceptance criteria.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.