Skip to content
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

Implement a helpful missing-symbol error for misconfigured main #145

Open
claremacrae opened this issue Jul 10, 2020 · 3 comments
Open

Implement a helpful missing-symbol error for misconfigured main #145

claremacrae opened this issue Jul 10, 2020 · 3 comments

Comments

@claremacrae
Copy link
Collaborator

We want to make a linker error something like this:

"__APPROVAL_MAIN_NOT_CONFIGURED::See_TroubleshootingMisconfiguredMain_Documentation::check()", referenced from:

But the initial underscore if global, and the double underscores are reserved.

@claremacrae
Copy link
Collaborator Author

We have an initial implementation sketched like this:

namespace v_v_v_v_v_v_v_v_v_APPROVAL_MAIN_NOT_CONFIGURED_v_v_v_v_v_v_v_v
{
  class Main_CPP_Not_Defined_Correctly
  {
} ;


  class See_TroubleshootingMisconfiguredMain_Documentation
  {
public:
    static Main_CPP_Not_Defined_Correctly check();
};
}

// then in Options, private:

    private:
      v_v_v_v_v_v_v_v_v_APPROVAL_MAIN_NOT_CONFIGURED_v_v_v_v_v_v_v_v::Main_CPP_Not_Defined_Correctly linkerCheck_ = v_v_v_v_v_v_v_v_v_APPROVAL_MAIN_NOT_CONFIGURED_v_v_v_v_v_v_v_v::See_TroubleshootingMisconfiguredMain_Documentation::check();


// and in a .cpp
namespace _v_v_v_v_v_v_v_v_v_APPROVAL_MAIN_NOT_CONFIGURED_v_v_v_v_v_v_v_v

{
    Main_CPP_Not_Defined_Correctly See_TroubleshootingMisconfiguredMain_Documentation::check()
{
return Main_CPP_Not_Defined_Correctly();
}

}

@claremacrae
Copy link
Collaborator Author

Reply from #include <C++> Discord:

X_X_X_X_X_X_X_APPROVAL_MAIN_NOT_CONFIGURED_X_X_X_X_X_X_X

i mean, tbh, the probability that _______________APPROVAL_MAIN_NOT_CONFIGURED_____________ is gonna get you in trouble in reality is extremely low^^

the main reason why reserved names exist is so that compilers and, most importantly, stdlib implementations have something that they can legally assume to not potentially be defined as macros by the user at the point where they include stdlib headers so they have something to work with…

@claremacrae
Copy link
Collaborator Author

I'd be really happy with X_X_X_X_X_X_X_APPROVAL_MAIN_NOT_CONFIGURED_X_X_X_X_X_X_X

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

No branches or pull requests

1 participant