Re: tgmath.h

Matthijs Kooijman <[email protected]> Fri, 22 Jul 2022 13:30:00 +0200
Newsgroups gmane.comp.hardware.avr.gcc
Message-ID <[email protected]>
--YiDfotnDR64l7yw7
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hi,

A bit of an old thread, but I wanted to add a bit more detail on how
Arduino handles C/C++ code.

> Arduino is a non-standard mix of C and C++, of undocumented (AFAIK) version,
> with an IDE that automates and hides some features (such as some headers).
> They use their own special libraries,

Arduino uses avr-gcc without changes, so anything supported by that
should work in Arduino. The build process has mostly two peculiarities:
 - It uses .ino files, which are merged into a single file (if you use
   multiple .ino files), and have auto-generated function prototypes
   added (so novice users do not have to care about this, though this
   also often breaks for more complex code).
 - For libraries, the build detects which files you #include and
   selects the libraries to compile (and put on the include path) based
   on those.

No system headers should be hidden, and no behavior-changing patches
shoulde be included in the avr-gcc and avr-libc builds.

> and an older version of avr-gcc that has a number of non-conformities.
Arduino is a bit slow to update at times, but is still updating the
toolchain every now and then.

> (Of particular relevance here, it has 32-bit "double" instead of
> 64-bit.)
Isn't this always the case on avr-gcc? Or is this a build-time option or
so?

> You cannot achieve your aims here with a single code base that works on
> Arduino tools and also on, say, a PC platform for simulation, and gives the
> same results.

There are actually some codebases that aim to simulate (or at least
stub) the Arduino API on a PC platform (other than the API, there is
nothing really special about Arduino code).



As for the original question about tgmath.h, it seems that it being
missing on Arduino is not a matter of C vs C++ or Arduino-specific
additions, but it seems that it is just missing from avr-libc entirely
(so will also be missing if you drop Arduino and use plain AVR). It also
seems it *is* present for ARM-based Arduino boards.


Gr.

Matthijs

--YiDfotnDR64l7yw7
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEMyF3AetYrDfGJ9el6ZMxy91tJYwFAmLaijEACgkQ6ZMxy91t
JYy3IxAAsNd0QOIGAFhFA+XQrAGpMcQV2hR8+o1nOzDcFhNH7pU8h8p3G4O6LxJ5
oiJ0EoWO69iRzDXPNtx936fNQjIq9RQe08Qosn+Wbs1fFlT4eT80xr9m7yTgzDF3
2N2SECdDuZrxMsrVxOjkFAewc2RcjybleQx5cnPZ/S8MrNrZ7zjbP+68Pb0Ran6g
iteWZNp3yoABY8iA0d7dxD1YD2nJnfPK1LDQQypti85ia0NtbJo1Gv7hPfPxgY+0
IhJqGPctpeOOz5YB2EAjNxQqcY4h0WaKAWqfHXsU5rxnrh+6gZTxTFiM0ofQc5Gl
bpP7gG9AE/PJdgIZ+/cjkK0K6F/UhGdCFEJbmxOlSheOBp5G1lTh0tNxCrB/57cA
0ZlMSAai5krVHYzzVz6KHadWI0RKwgHKVs8Q8+QpBPz0ay7dyL9/gi4GGOc3d09T
P7MAWpV2Qh2+qB45sP2BeQrFqUrPYExwkV9UmKt+WBszpXO1dIWaIR0HrSG0Cszz
VPan5CyHePau1RWsyUqTOvxeiJWCwiRMhcunb7eqYIPA11t4n4MnJuCo4xrdS5Ax
9zzWw9/0+v3XYKrfxRL9SwYPnRZB6XMcyVrIIPm+OvLlyamzdGdNUo+XFFkOBc4z
QaMlOckkhAJ2B6zddVwKBbooj9r8IyPqi0w9SNrXLFtwuL19CTo=
=Gtsh
-----END PGP SIGNATURE-----

--YiDfotnDR64l7yw7--