avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tgmath.h


From: Matthijs Kooijman
Subject: Re: tgmath.h
Date: Fri, 22 Jul 2022 13:30:00 +0200

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

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]