Is there some kind of problem with using FLT_MIN in ANSI mode?


The C compiler dislikes this construct in ANSI mode:

x = FLT_MIN; /* <---- warning here */

The problem is that the ANSI mode (_PROTOTYPES) version of
FLT_MIN/FLT_MAX in <float.h> end their constants with an F, which seems
to upset the compiler.

The workaround is to temporarily undef _PROTOTYPES around the <float.h>
inclusion:

#ifdef _PROTOTYPES
#undef _PROTOTYPES
#include <float.h>
#define _PROTOTYPES
#else
#include <float.h>
#endif



UNIXguide.net
Suggest a Site