GEOS-DEV / GEOS-DEV/GEOS

Transition from macro existence checking (`#ifdef(foo)`) to value checking (`#if foo == 1`) in general

Open
#2,201 5 comments 0 reactions 1 assignee View on GitHub

@wrtobin is already working on this.

Since Dec 6, 2022.

type: cleanup / refactor
Dominant language
C++
Stars
287
Forks
109
Avg merge
4d 41m
Merged PRs (30d)
5

Description

Detecting macro existence via #ifdef can lead to esoteric compilation problems due to the visibility of symbols depending on the set of included headers in a compilation scope.

Detecting instead the value of a macro that should always be defined will result in an error when the macro isn't defined and make the issues that can be caused by the above almost trivial to track down.

We might also want to take advantage of #cmakedefine01 as part of this to change our config header from defined/undefined to #define FOO 0/1 consistently.

  • @bmhan12 Find out the motivation for using #if defined() in AXOM, and drawbacks to proposal.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.