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

Add version to header #89

Open
aggsol opened this issue Mar 6, 2018 · 5 comments
Open

Add version to header #89

aggsol opened this issue Mar 6, 2018 · 5 comments
Assignees
Milestone

Comments

@aggsol
Copy link

aggsol commented Mar 6, 2018

I usually copy the header into my projects but it is hard to track which version it is. How about adding a #define RANG_VERSION to it?

@kingseva
Copy link
Collaborator

kingseva commented Mar 6, 2018

It's also good idea to add version/about functions that returns version string and short description of the library.

@agauniyal
Copy link
Owner

@aggsol would -

#define RANG_VERSION_MAJOR 3
#define RANG_VERSION_MINOR 1
#define RANG_VERSION_PATCH 0

format fine for you?

@kingseva why not constexpr members inside rang:: namespace 😛

cout << rang::version << rang::description;

though I don't know if people really use versions like this 🤔. Anyways I'll add both in next version 👍

@aggsol
Copy link
Author

aggsol commented Mar 7, 2018

@agauniyal Fine for mie, I just need a way to manually check what version a header is.

@agauniyal
Copy link
Owner

Added for next-release.

@agauniyal agauniyal self-assigned this Mar 8, 2018
@agauniyal agauniyal added this to the Release 4.0 milestone Mar 8, 2018
@kingseva
Copy link
Collaborator

I think it will be more convenient to place version macros is on top of the header not on the bottom 😄. Most of developers don't like to scroll down headers to see witch version of header they addded to the project.

Also it's handy to use check version macros:

#include <iostream>

#define RANG_VERSION_MAJOR 4
#define RANG_VERSION_MINOR 0
#define RANG_VERSION_PATCH 0

#define RANG_VER_CHECK(major,minor,patch) (((major) << 16) | ((minor) << 8) | (patch))
#define RANG_VER RANG_VER_CHECK(RANG_VERSION_MAJOR,RANG_VERSION_MINOR,RANG_VERSION_PATCH)

int main()
{
#if RANG_VER >= RANG_VER_CHECK(4,0,0)
    std::cout << "Hello, rang 4 !\n";
#endif
}

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

3 participants