-
Notifications
You must be signed in to change notification settings - Fork 137
Fix MANIFOLD_DEBUG guards for Read/Write OBJ api #1226
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -720,7 +720,6 @@ std::ostream& operator<<(std::ostream& stream, const Manifold::Impl& impl) { | |
* Write function. | ||
*/ | ||
Manifold Manifold::ReadOBJ(std::istream& stream) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't we have to guard the implementations the same way as the headers? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe pull master and check - I feel like this won't compile as is with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes we do - there is an ifdef MANIFOLD_DEBUG guarding the whole block on line 685. I forgot to remove it when I added the method internal versions in the previous commit, so I didn't need to re-add it here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Come to think of it - do all the CI tests have MANIFOLD_DEBUG=ON? |
||
#ifdef MANIFOLD_DEBUG | ||
if (!stream.good()) return Invalid(); | ||
|
||
MeshGL64 mesh; | ||
|
@@ -782,9 +781,6 @@ Manifold Manifold::ReadOBJ(std::istream& stream) { | |
auto m = std::make_shared<Manifold::Impl>(mesh); | ||
if (epsilon) m->SetEpsilon(*epsilon); | ||
return Manifold(m); | ||
#else | ||
return Invalid(); | ||
#endif | ||
} | ||
|
||
/** | ||
|
@@ -794,15 +790,10 @@ Manifold Manifold::ReadOBJ(std::istream& stream) { | |
* by WriteOBJ should be read back in with ReadOBJ. | ||
*/ | ||
bool Manifold::WriteOBJ(std::ostream& stream) const { | ||
#ifdef MANIFOLD_DEBUG | ||
if (!stream.good()) return false; | ||
stream << *this->GetCsgLeafNode().GetImpl(); | ||
return true; | ||
#else | ||
return false; | ||
#endif | ||
} | ||
|
||
#endif | ||
|
||
} // namespace manifold |
Uh oh!
There was an error while loading. Please reload this page.
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.
I'm honestly curious, from a consumer's perspective - is this more convenient? This way if you write code that uses these and then change your CMake flag, it'll suddenly stop compiling. The old way it would just fail to run. Which do we think is better behavior?
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.
Good question. I am a PL guy, so I want more static guarantees. But from a user perspective, failing the compilation may not be the best way...
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.
If the headers are going to be behind the MANIFOLD_DEBUG guard, don't these methods need to be too? Otherwise user code might not compile anyway due to not having the necessary includes?
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.
Oh right, the point is to not include the stream definitions, so we do have to guard them this way. I suppose finding out about problems earlier (compilation) is better than later (runtime).