| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
All these stray -1 and \n are really awful and make this feel very wrong. |
Sorry, something went wrong.
I am not sure why the -1 are needed. Not saying it's wrong, I just don't understand it. The \n makes the testcode technically valid. Are you suggestion to remove those and ensure that warnings are written properly? |
Sorry, something went wrong.
Me neither. Passing less means that the newline would be missing and the other changes add it. That is kind of a flip-flop.
If fiddling with the trailing newline is necessary that seems like a possible source of issues for users of the library. |
Sorry, something went wrong.
The char arrays that are initialized with a string constant include a null terminator, which makes these test cases fail because they end with '\0' instead of '\n'.
I agree that it looks really ugly but it's not wrong. |
Sorry, something went wrong.
|
I also agree that it's a bit awkward to implement this in simplecpp, since it doesn't really distinguish between C and C++. |
Sorry, something went wrong.
Maybe we should something more explicit to highlight what we are doing and it doesn't look like we randomly added those. We should probably land #666 first which allows passing the actual sizes instead of just relying onto strlen(). |
Sorry, something went wrong.
Of course we should write test code properly. If the newline is not included in the test code then it is not included.
It's not "ugly" to write test code properly. I understand now why you write sizeof(code)-1 and that is the proper way to calculate the size. I.e. if we have const char code[] = "abcde"; then sizeof(code) will return 6. If we pass 6 as size argument to the preprocess function then we tell the preprocess function that it should read the null character after the 'e' when preprocessing. If we don't intended that then we should not pass 6. |
Sorry, something went wrong.
I want that we are able to find this UB. But we do need to distinguish C/C++ somewhere. I can see these options:
current solution seems OK to me. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
No description provided.