diff options
Diffstat (limited to 'docs/user-guide')
| -rw-r--r-- | docs/user-guide/03-convenience-features.md | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/docs/user-guide/03-convenience-features.md b/docs/user-guide/03-convenience-features.md index ca4635df4..a325f64f3 100644 --- a/docs/user-guide/03-convenience-features.md +++ b/docs/user-guide/03-convenience-features.md @@ -363,19 +363,21 @@ float4 myPackedVector = reinterpret<float4>(myVal); ## Pointers -Slang supports pointers when generating code for SPIRV, C++ and CUDA targets. The syntax for pointers is similar to C, with the exception that operator `.` can also be used to dereference a member. Slang currently does not support the `->` operator. -For example: +Slang supports pointers when generating code for SPIRV, C++ and CUDA targets. The syntax for pointers is similar to C, with the exception that operator `.` can also be used to dereference a member from a pointer. For example: ```csharp int test(MyType* pObj) { MyType* pNext = pObj + 1; MyType* pNext = &pNext[1]; - return pNext.a + (*pNext).a + pNext[0].a; + return pNext.a + pNext->a + (*pNext).a + pNext[0].a; } ``` Pointer types can also be specified using the generic syntax: `Ptr<MyType>` is equivalent to `MyType*`. +> #### Note +> Slang currently does not support pointers to immutable values, i.e. `const T*`. + ## `struct` inheritance (limited) Slang supports a limited form of inheritance. A derived `struct` type has all the members defined in the base type it is inherited from: |
