-
Notifications
You must be signed in to change notification settings - Fork 99
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
@@ -507,7 +513,11 @@ bool nob_set_current_dir(const char *path); | |||
# define nob_cc(cmd) nob_cmd_append(cmd, "cl.exe") | |||
# endif | |||
# else | |||
# define nob_cc(cmd) nob_cmd_append(cmd, "cc") | |||
# if defined(__cplusplus) | |||
# define nob_cc(cmd) nob_cmd_append(cmd, "c++") |
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.
cc
stands for C Compiler. I don't think anybody using this would expect CC to be a c++ compiler (the two are not easily interchangeable specifically planed for)
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.
cc
stands for C Compiler. I don't think anybody using this would expect CC to be a c++ compiler (the two are not easily interchangeable specifically planed for)
tho you can name main.cc and it stands for C++ (C with Classes, is a old way to do it but..)
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