Skip to content

How to Disable Both OF_LEGACY_INCLUDE_STD and OF_USE_MINIMAL_STD #8318

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

Open
2bbb opened this issue Mar 1, 2025 · 2 comments
Open

How to Disable Both OF_LEGACY_INCLUDE_STD and OF_USE_MINIMAL_STD #8318

2bbb opened this issue Mar 1, 2025 · 2 comments

Comments

@2bbb
Copy link
Contributor

2bbb commented Mar 1, 2025

I believe that OF_USE_MINIMAL_STD is a best-effort way to maintain compatibility. However, I think it would be good to provide a method to disable it entirely as well.

For example, like the following:

#ifndef OF_DISABLE_INCLUDE_STD
    #ifdef OF_LEGACY_INCLUDE_STD
using namespace std;
    #else

// this will eventually be disabled by default
        #define OF_USE_MINIMAL_STD
        #ifdef OF_USE_MINIMAL_STD
using std::cout;
using std::deque;
using std::endl;
using std::make_shared;
using std::map;
using std::max;
using std::pair;
using std::shared_ptr;
using std::string;
using std::stringstream;
using std::swap;
using std::to_string;
using std::vector;
using std::weak_ptr;
        #endif // OF_USE_MINIMAL_STD
    #endif // OF_LEGACY_INCLUDE_STD
#endif // ifndef OF_DISABLE_INCLUDE_STD

This is a method that ignores both using statements by defining OF_DISABLE_INCLUDE_STD.
Is there a better approach?

@2bbb 2bbb changed the title Disabling OF_USE_MINIMAL_STD How to Disable Both OF_LEGACY_INCLUDE_STD and OF_USE_MINIMAL_STD Mar 1, 2025
@artificiel
Copy link
Contributor

@2bbb yes this was a compromise to immediately get the bad byte and other conflicts out of the way, while providing a "manual" access point for updating core with no using. the idea is to make these opt-in, so the temporary line #define OF_USE_MINIMAL_STD will be removed after the next release (12.1), then the conditionals will make more sense.

@dimitre
Copy link
Member

dimitre commented Mar 1, 2025

I like your approach and I vote so it can be made to 0.12.1

It can be moved (maybe) to projects later, handled by projectGenerator.

I've been writing ofGen (alternative to PG) that works from a recipe, so we can have a configuration like this:

defines:
  - NANOVG_GL2_IMPLEMENTATION

so it reflects in different templates as

config.make

PROJECT_DEFINES = NANOVG_GL2_IMPLEMENTATION

xcode / Project.xcconfig

 GCC_PREPROCESSOR_DEFINITIONS=$(inherited) NANOVG_GL2_IMPLEMENTATION

etc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants