# how does vtkIdType work?

**URL:** https://discourse.vtk.org/t/how-does-vtkidtype-work/5024
**Category:** Support
**Created:** [January 17, 2021, 8:38am UTC](https://discourse.vtk.org/t/how-does-vtkidtype-work/5024 "2021-01-17T08:38:31Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![1116](https://discourse.vtk.org/user_avatar/discourse.vtk.org/1116/32/1506_2.png) [@1116](https://discourse.vtk.org/u/1116)
#### Post date: [January 17, 2021, 8:38am UTC](https://discourse.vtk.org/t/how-does-vtkidtype-work/5024/1 "2021-01-17T08:38:31Z")

</div>

It looks that vtkIdType can be an integer type with the 32bit or 64bit based on runtime information ([https://vtk.org/doc/release/4.2/html/classvtkIdType.html](https://vtk.org/doc/release/4.2/html/classvtkIdType.html)), I’m curious how it works, where it is defined, and what are related macro definitions or header files in the latest VTK library.  
Thanks!

---

<div class="post-metadata">

### Author: ![Joachim\_P](https://discourse.vtk.org/user_avatar/discourse.vtk.org/joachim_p/32/3272_2.png) [@Joachim\_P](https://discourse.vtk.org/u/Joachim_P)
#### Post date: [January 17, 2021, 11:41pm UTC](https://discourse.vtk.org/t/how-does-vtkidtype-work/5024/2 "2021-01-17T23:41:50Z")

</div>

The size of `vtkTypeId` depends on the CMake variable `VTK_USE_64BIT_IDS`. The default value is OFF (resulting in 32bits ids) on 32 bits systems, ON (64bits) on other systems. Then, the file `vtkFileTraits.h` defines `vtkIdType` type depending on this variable.

---

<div class="post-metadata">

### Author: ![1116](https://discourse.vtk.org/user_avatar/discourse.vtk.org/1116/32/1506_2.png) [@1116](https://discourse.vtk.org/u/1116)
#### Post date: [January 18, 2021, 2:35am UTC](https://discourse.vtk.org/t/how-does-vtkidtype-work/5024/3 "2021-01-18T02:35:48Z")

</div>

Thanks for the information, is the `vtkFileTraits.h` created during the building process? I could not find it in the source code repo.

---

<div class="post-metadata">

### Author: ![1116](https://discourse.vtk.org/user_avatar/discourse.vtk.org/1116/32/1506_2.png) [@1116](https://discourse.vtk.org/u/1116)
#### Post date: [January 18, 2021, 2:40am UTC](https://discourse.vtk.org/t/how-does-vtkidtype-work/5024/4 "2021-01-18T02:40:08Z")

</div>

I find it by searching `VTK_USE_64BIT_IDS ` in the source code repo, it looks that the definition is here ([https://github.com/Kitware/VTK/blob/master/Common/Core/vtkType.h#L309](https://github.com/Kitware/VTK/blob/master/Common/Core/vtkType.h#L309))

---

<div class="post-metadata">

### Author: ![Joachim\_P](https://discourse.vtk.org/user_avatar/discourse.vtk.org/joachim_p/32/3272_2.png) [@Joachim\_P](https://discourse.vtk.org/u/Joachim_P)
#### Post date: [January 23, 2021, 11:05am UTC](https://discourse.vtk.org/t/how-does-vtkidtype-work/5024/5 "2021-01-23T11:05:54Z")

</div>

Oups you are right I made a typo in my answer.
