-
Notifications
You must be signed in to change notification settings - Fork 166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
64bit expressions used in #[el]if statements #1389
Comments
It happens on Win32/Win64 hosted compilers (I tested both). Linux hosted is said to be okay. This was done by Przemyslaw to workaround truncations in these macros: |
The issue is caused by C standard. |
I suppose "LONGLONG" ints shouldn't be enabled in compiler too if preprocessor in this mode is strictly limited? Why enable 64-bit ints for compiler in C89 mode? |
It is for backward compatibility with previous OW and Watcom versions and compatibility with C standard. |
Now i'm just curious what was different in a ~2020 OW, which didn't manifest anything like that... |
Do you want to say that in current version is bug? |
New preprocessor was introduced by following commit Commit 546c585 |
|
It is irrelevant what was doing older version, only C standard is relevant. |
Hmm, don't need to explain that , we're quite used to what's possible under ANSI C. Anyway OpenWatcom also set up kind of it's own standard after all these years ;-) |
Older didn't truncate PP in this scenario either. We looked as far as #include "limits.h"
#include "stdint.h"
#include "stdio.h"
/* extracted from hbdefs.h */
#if ! defined( LONGLONG_MAX )
#if defined( _I64_MAX )
#define LONGLONG_MAX _I64_MAX
#elif defined( LLONG_MAX )
#define LONGLONG_MAX LLONG_MAX
#elif defined( LONG_LONG_MAX )
#define LONGLONG_MAX LONG_LONG_MAX
#else
#define LONGLONG_MAX 9223372036854775807LL
#endif
#endif
void main()
{
#if LONGLONG_MAX < LONG_MAX
#error "BUG"
#endif
printf("LONG_MAX %d\n", LONG_MAX );
printf("LONGLONG_MAX %I64d\n", LONGLONG_MAX );
} (redacted, preprocessor case only) |
Sorry, but C++ compiler work with different standard C++98 I don't know how much it is different from C89 or C99. Maybe it looks like old version worked correctly in some situation but how can have precision if all internal variables were 32-bit. It is not about macro value. |
Case just shows what we know about it, thanks for looking at it. Lastly, I can confirm that cross building from Linux results are the same as Win32/Win64 - there is no difference between host platforms, so the "Win32 version" may be discarded from title of this issue. |
Hi,
@jmalak can you look at the original message 64bit expressions used in #[el]if statements about subj?
Thanks
The text was updated successfully, but these errors were encountered: