- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Consider the following example:
#define A 42
#define F(X) defined(X)&&X<137
#if F(A)
print*,A
#endif
end
The executable compiled with `gfortran` will print the number, while the executable from `ifx` (2025.0.0) will not. This difference is caused by the rules of macro expansion that are not defined by the Fortran standard. The ability to include `defined` in macros is convenient, since repeating `#if` statements with complex expressions can be shortened. Since the preprocessor in `ifx` is not error-free, I'd like to ask, if it is the intended behavior and what is the reason for these macro expansion rules.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is only a minimal example to keep the question short. I'm aware that the task in this example can be achieved by different means. In my real project (which I will not be posting here), the use of `defined` inside macros can significantly simplify the code and avoid error-prone repetitions. You cannot judge the need of this feature or the complexity of the project I'm working on by analyzing this example. Furthermore, your comment neither answers my question nor does it in any way help to clarify this matter.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page