# VNL is not C++17 compatible

**URL:** <https://discourse.itk.org/t/vnl-is-not-c-17-compatible/1296>\
**Category:** Engineering\
**Created:** [September 20, 2018, 7:23pm UTC](https://discourse.itk.org/t/vnl-is-not-c-17-compatible/1296 "2018-09-20T19:23:07Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![spinicist](https://discourse.itk.org/user_avatar/discourse.itk.org/spinicist/32/183_2.png) [@spinicist](https://discourse.itk.org/u/spinicist)\
**Post date:** [September 20, 2018, 7:23pm UTC](https://discourse.itk.org/t/vnl-is-not-c-17-compatible/1296/1 "2018-09-20T19:23:07Z")

</div>

Hello,

I’ve just tried building ITK master with C++17 enabled with Apple’s latest compiler `Apple LLVM version 10.0.0 (clang-1000.11.45.2)` and I get the following error:

```auto
In file included from ../Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_netlib.h:5:
../Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c.h:29:14: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
void sig_die(register char *s, int kill);

```

I’ll try compiling ITK with a lower C++ standard, but that has produced warnings for me before. I am aware that ITK has only just made it onto C++11, but when I tried `if constexpr` it simplified a class of mine so much I decided it was worth sticking with.

---

<div class="post-metadata">

**Author:** ![matt.mccormick](https://discourse.itk.org/user_avatar/discourse.itk.org/matt.mccormick/32/7_2.png) [@matt.mccormick](https://discourse.itk.org/u/matt.mccormick)\
**Post date:** [September 20, 2018, 7:44pm UTC](https://discourse.itk.org/t/vnl-is-not-c-17-compatible/1296/2 "2018-09-20T19:44:20Z")

</div>

> [@spinicist](#):
>
> [-Wregister]

Since it is a warning, we could suppress it for now (this is just C code).

And start thinking more about moving from VNL to Eigen for ITK 6…

---

<div class="post-metadata">

**Author:** ![spinicist](https://discourse.itk.org/user_avatar/discourse.itk.org/spinicist/32/183_2.png) [@spinicist](https://discourse.itk.org/u/spinicist)\
**Post date:** [September 20, 2018, 7:47pm UTC](https://discourse.itk.org/t/vnl-is-not-c-17-compatible/1296/3 "2018-09-20T19:47:28Z")

</div>

> [@matt.mccormick](#):
>
> And start thinking more about moving from VNL to Eigen for ITK 6…

I wish I had the time to volunteer for that!

---

<div class="post-metadata">

**Author:** ![seanm](https://discourse.itk.org/letter_avatar_proxy/v4/letter/s/a88e4f/32.png) [@seanm](https://discourse.itk.org/u/seanm)\
**Post date:** [September 20, 2018, 8:33pm UTC](https://discourse.itk.org/t/vnl-is-not-c-17-compatible/1296/4 "2018-09-20T20:33:03Z")

</div>

Matt,

It’s not a warning, it’s an error. ‘register’ was deprecated previously, but is entirely removed in C++17.

Sean

---

<div class="post-metadata">

**Author:** ![matt.mccormick](https://discourse.itk.org/user_avatar/discourse.itk.org/matt.mccormick/32/7_2.png) [@matt.mccormick](https://discourse.itk.org/u/matt.mccormick)\
**Post date:** [September 20, 2018, 8:54pm UTC](https://discourse.itk.org/t/vnl-is-not-c-17-compatible/1296/5 "2018-09-20T20:54:53Z")

</div>

> [@seanm](#):
>
> It’s not a warning, it’s an error. ‘register’ was deprecated previously, but is entirely removed in C++17.

☹

@spinicist do you have more information on the traceback and the command that is invoked? Can we do the compilation as C instead of C++?

---

<div class="post-metadata">

**Author:** ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)\
**Post date:** [September 21, 2018, 5:19pm UTC](https://discourse.itk.org/t/vnl-is-not-c-17-compatible/1296/6 "2018-09-21T17:19:00Z")

</div>

As `register` keyword was an optimization hint since it was introduced, just removing it from the code is probably the best solution? Of course, submit the patch to VNL and then update ITK’s copy of it.

---

<div class="post-metadata">

**Author:** ![seanm](https://discourse.itk.org/letter_avatar_proxy/v4/letter/s/a88e4f/32.png) [@seanm](https://discourse.itk.org/u/seanm)\
**Post date:** [September 21, 2018, 8:20pm UTC](https://discourse.itk.org/t/vnl-is-not-c-17-compatible/1296/7 "2018-09-21T20:20:52Z")

</div>

Yup, that’s the only solution if VNL is a codebase that wants to keep compiling in the future. 🙂

---

<div class="post-metadata">

**Author:** ![mihail.isakov](https://discourse.itk.org/letter_avatar_proxy/v4/letter/m/c4cdca/32.png) [@mihail.isakov](https://discourse.itk.org/u/mihail.isakov)\
**Post date:** [September 22, 2018, 1:59am UTC](https://discourse.itk.org/t/vnl-is-not-c-17-compatible/1296/8 "2018-09-22T01:59:30Z")

</div>

> error: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]

What does -Wregister (-Wno-register) argument do? May be it turns error into warning. But anyway removing “register” from code is good.

---

<div class="post-metadata">

**Author:** ![spinicist](https://discourse.itk.org/user_avatar/discourse.itk.org/spinicist/32/183_2.png) [@spinicist](https://discourse.itk.org/u/spinicist)\
**Post date:** [September 24, 2018, 1:09pm UTC](https://discourse.itk.org/t/vnl-is-not-c-17-compatible/1296/9 "2018-09-24T13:09:00Z")

</div>

@matt.mccormick There wasn’t anything special about this compilation - I configured with `-DCMAKE_CXX_STANDARD=17` and then compiled. Apple updated Clang last week with better C++17 compliance.

As I can make this work by dropping back to C++14/11 to compile ITK, I don’t really want to go through the process of submitting a patch to VNL. If I spent anytime in that direction, I’d prefer it to be on getting Eigen into ITK.

---

<div class="post-metadata">

**Author:** ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)\
**Post date:** [September 24, 2018, 2:07pm UTC](https://discourse.itk.org/t/vnl-is-not-c-17-compatible/1296/10 "2018-09-24T14:07:18Z")

</div>

I think we agreed we wanted Eigen to replace VNL. But I am afraid we estimated that to be quite an effort. And minor cleanup of VNL to be C++17 compatible is a sneeze compared to a switch to Eigen.

---

<div class="post-metadata">

**Author:** ![matt.mccormick](https://discourse.itk.org/user_avatar/discourse.itk.org/matt.mccormick/32/7_2.png) [@matt.mccormick](https://discourse.itk.org/u/matt.mccormick)\
**Post date:** [September 24, 2018, 2:48pm UTC](https://discourse.itk.org/t/vnl-is-not-c-17-compatible/1296/11 "2018-09-24T14:48:28Z")

</div>

I went ahead and created a PR to `vxl` here:

> <https://github.com/vxl/vxl/pull/502>

CC: @hjmjohnson

---

<div class="post-metadata">

**Author:** ![spinicist](https://discourse.itk.org/user_avatar/discourse.itk.org/spinicist/32/183_2.png) [@spinicist](https://discourse.itk.org/u/spinicist)\
**Post date:** [October 1, 2018, 1:33pm UTC](https://discourse.itk.org/t/vnl-is-not-c-17-compatible/1296/12 "2018-10-01T13:33:21Z")

</div>

Thanks @matt.mccormick
