|
|
Re: Previous variable value into another variable?
[Re: 3dgs_snake]
#347073
11/12/10 09:43
11/12/10 09:43
|
Joined: Apr 2007
Posts: 3,751 Canada
WretchedSid
Expert
|
Expert
Joined: Apr 2007
Posts: 3,751
Canada
|
Woah, 3dgs_snake, what you are doing looks pretty risky. The compiler will cast your var to an var* when you call the function like you are doing, and that will likely result in a segfault. You may want to use the & operator for this 
Shitlord by trade and passion. Graphics programmer at Laminar Research. I write blog posts at feresignum.com
|
|
|
Re: Previous variable value into another variable?
[Re: WretchedSid]
#347077
11/12/10 10:25
11/12/10 10:25
|
Joined: Feb 2010
Posts: 320 TANA/Madagascar
3dgs_snake
Senior Member
|
Senior Member
Joined: Feb 2010
Posts: 320
TANA/Madagascar
|
 Yes, It was an error when I did it in the first time, but I tested and it seems to run fine, so I didn't change. Also in the the documentation it is said that Lite-C automatically detects if a function expects a variable or a pointer to a variable, so you can usually omit the '&' and just write: change_variable_p(x); // now x is 11
 But I totally agree that it is a best practice to use the '&', and it is more clean. Thanks.
|
|
|
Re: Previous variable value into another variable?
[Re: 3dgs_snake]
#347079
11/12/10 10:59
11/12/10 10:59
|
Joined: Apr 2007
Posts: 3,751 Canada
WretchedSid
Expert
|
Expert
Joined: Apr 2007
Posts: 3,751
Canada
|
Okay, didn't knew that, thats horrible 
Shitlord by trade and passion. Graphics programmer at Laminar Research. I write blog posts at feresignum.com
|
|
|
|