Re: [hatari-devel] Removing SDL use for byte order checks / conversions

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Hi,

Defines should be upper case, and more than 2 letters I think.

IMHO better solution is just moving
the "ifndef M_PI, define M_PI" to a common header, after "include <math.h>".


	- Eero

On 5.10.2022 0.55, David Savinkoff wrote:
Dear Sirs:

An unused M_PI define in src/falcon/dsp_core.c is the only M_PI in
Hatari that is not my fault.

I have come to the conclusion that the entirety of computer science
has had decades to find a way of representing pi and has failed.
   Thus, the correct way of defining pi on a computer in C is as follows:
#define pi 3.14159265358979323846264338327950 /* use more digits if needed
*/
Note that pi is lower case because pi is fundamentally more important than
C convention.

Here are three patches to purge M_PI

On Mon, Oct 3, 2022 at 9:25 AM Christian Zietz <czietz@xxxxxxx> wrote:

David Savinkoff schrieb:

I think MSFT is trying to be a trouble maker here, so use the force.

It's always easy and convenient to blame Microsoft, I know. But -- as
Thomas already wrote -- M_PI is *not* part of math.h in ANSI C. You will
find that glibc's math.h does not define it unconditionally either:

https://github.com/bminor/glibc/blob/b7bd94068e55d5fa8681e2ab4802d31852ea404e/math/math.h#L1144
... it's just that __USE_MISC or __USE_XOPEN is set somewhere else.

I would conditionally define M_PI most accurately in a future-proof way.

... and, therefore, this suggestion might be good solution.

Regards
Christian
--
Christian Zietz  -  CHZ-Soft  -  czietz@xxxxxxx
WWW: https://www.chzsoft.de/
New GnuPG-Key-ID: 0x8708B34C827B159E








Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/