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

restructuring: added macros for stringification #533

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions BunnymodXT/shared.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,11 @@ constexpr int kRenderFxTrigger = 241; // DO NOT CHANGE THIS VALUE OR YOU WILL BR

// - Other constants
constexpr steamid_t STEAMID64_CONST = 76561197960265728; // 0x110000100000000

// - Custom macros

#define _BXT_STRINGIFY(x) #x
#define BXT_TOSTRING(x) _BXT_STRINGIFY(x)
#define BXT_CONCATENATE(x, y) x##y
#define BXT_CONCATENATE_DETAIL(x, y) BXT_CONCATENATE(x, y)
Comment on lines +53 to +54
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just BXT_CONCAT()? Also what does "DETAIL" mean?

Copy link
Collaborator Author

@SmileyAG SmileyAG Jul 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does "DETAIL" mean?

#define test RTY
BXT_TOSTRING(BXT_CONCATENATE(QWE, test)) // "QWEtest" string
BXT_TOSTRING(BXT_CONCATENATE_DETAIL(QWE, test)) // "QWERTY" string

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah but what does the word "DETAIL" have to do with this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What else should it be called then? BXT_CONCATENATE_EXPAND?

Both of these macros are valuable in different situations, so I didn't add the _ prefix like I did with _BXT_STRINGIFY, which emphasized that it was just a helper macro for another macro, but that's not the case here.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like EXPAND better yeah

#define BXT_FUNC __func__