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

fix compilation issues with cxx examples #245

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

dbworth
Copy link

@dbworth dbworth commented Nov 17, 2018

Please see details in the issue ticket

@ajpmaclean
Copy link
Collaborator

@dbworth I have doubts about this for the reasons outlined in points 1-5, however I think you have hit on a possible rather neat solution to the continuing issue of compiler/VTK versions if you look at my comments after points 1-5.

  1. If you read VTK/Wrapping C++11 Code_Code, VTK , since 6.1 mostly supports c++11 and c++14.
  2. Following on from point 1. I don't see the point of refactoring existing contributions to support older compilers/versions of VTK. This will detract people from contributing, especially if they see code requiring lots of #ifdefs as they may not have the background knowledge relating to older versions of VTK.. In any case, people will re-work examples if they have to to support older versions.
  3. I would not be happy removing auto, array, replacing nullptr with NULL in existing code. We have had lots on debates in the past on the developers list over this.
  4. Adding lots of #ifdefs to examples to support different versons of VTK compilers also makes code hard to read and understand.
  5. I think the added complexity of CMake changes may be detrimental to new contributors.

Based on what you have done here, it would be better in ForUsers to add a table listing the vtk version and what may fail so users can modify existing code maybe something like this:

VTK Versions

In some versions of VTK you may need additional VTK headers:

  • eg. you may need to add: #include <vtkSmartPointer.h>

If your vtk Version is less than 8, you may need to replace:

  • vtkNew with vtkSmartPointer

Compiler Versions

If your compiler is not C++11 compliant:

  • replace auto e.g replace auto scale = 0.5;with const double scale = 0.5;.
  • replace nullptr with NULL.
  • replace std::array with std::vector.
  • lambda expressions will need to be replaced by either inlining the code or creating a class.

This would be a very valuable contribution and you have already picked up most of these changes!

@Bill what do you think?

@dbworth
Copy link
Author

dbworth commented Nov 17, 2018

I was under the impression that VTKExamples was a separate project to VTK (and the examples included with that codebase). This might suggest a different set of guidelines about coding style or dependencies.

Before discussing this in more detail, I would ask the maintainers of the VTKExamples for their opinion on this:

Should the VTK Examples be a "compilable" repo of code?

  • No, it's a collection of code fragments but we prefer Github pages to MediaWiki, Pastebin, etc.
  • No, they should compile but maybe don't. YMMV.
  • Yes, the entire repo of examples should compile as the documentation says.
  • Yes, but only a small minimal sub-set of examples (the others have to be enabled by the user).

@lorensen
Copy link
Owner

lorensen commented Nov 17, 2018 via email

@lorensen
Copy link
Owner

lorensen commented Nov 17, 2018 via email

@dbworth
Copy link
Author

dbworth commented Nov 17, 2018

Thanks for the feedback.

Do you want any of the suggestions in this PR or should I squash it?

@lorensen
Copy link
Owner

lorensen commented Nov 17, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants