summaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/user-guide/03-convenience-features.md9
1 files changed, 7 insertions, 2 deletions
diff --git a/docs/user-guide/03-convenience-features.md b/docs/user-guide/03-convenience-features.md
index 8954349f7..420db18c1 100644
--- a/docs/user-guide/03-convenience-features.md
+++ b/docs/user-guide/03-convenience-features.md
@@ -411,11 +411,16 @@ float4 myPackedVector = reinterpret<float4>(myVal);
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
+struct MyType
+{
+ int a;
+};
+
int test(MyType* pObj)
{
MyType* pNext = pObj + 1;
- MyType* pNext = &pNext[1];
- return pNext.a + pNext->a + (*pNext).a + pNext[0].a;
+ MyType* pNext2 = &pNext[1];
+ return pNext.a + pNext->a + (*pNext2).a + pNext2[0].a;
}
```