-
Notifications
You must be signed in to change notification settings - Fork 67
Added support for c++ #59
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
base: main
Are you sure you want to change the base?
Conversation
size_t new_count; | ||
#ifndef _WIN32 | ||
long m; | ||
#else | ||
long long m; | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you separate declaration and initialization? does c++ not work without it?
const char *message; | ||
const char *message_file_path; | ||
Proc p; | ||
String_View actual_message; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same question here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the preprocessor (and goto) rules in C++ are strictier than the C. The usage of "return_defer" macro must be after all declaration. So you cannot jump with goto after a declaration+initialization of a variable. So i simply separated them and all works as expected
Hi tsoding, i love this project and i would love to use it with c++. I have modified nob.h (and a test) to compile with g++ and clang++. I have run the nob with c and c++ with my modified version and both works! The only "meh", is that with c++ you have a lot of warnings in the tests (because of some differences between c and c++) but all works as expected i think