cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

spectral
Adept II

BUG : float4 pointer is invalid

Hi, I would like to use the pointer to a float4 like this :

float4 f;
float4* pt = &f;

pt->x = 1.f;

But I got a compilation error !!

0 Likes
4 Replies

Originally posted by: viewon01 Hi, I would like to use the pointer to a float4 like this :

 

float4 f; float4 pt;

 

pt->x = 1.f;

 

But I got a compilation error !!

 

pt is not a pointer.  Try pt.x.

Jeff

0 Likes

Sorry, I have corrected the example !

0 Likes

You are not allowed to use operator ->, I reckon. Just substitute it with (*pt).x = 1.f;

0 Likes

Originally posted by: karbous You are not allowed to use operator ->, I reckon. Just substitute it with (*pt).x = 1.f;

 

This is correct.  float4 is not a struct, it's a special vector type.  Thus, p->x doesn't make sense.

Jeff

0 Likes