arduino / arduino/ArduinoCore-API

Why not using abs() from stdlib?

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

Description

Why does Arduino.h use its own abs() if stdlib has this already builtin. This causes me problems in build environments. I dont see any reason why one would prefer an Arduino definition. Can we get rid of it?
```
#define abs(x) ((x)>0?(x):-(x))
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading Arduino.h and locating the local abs(x) macro shown in the issue. Check how the standard library and affected build environments resolve abs, then verify that removing the Arduino definition does not break existing Arduino API builds or users that rely on it.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
api, embedded-iot
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.