Quantcast
Channel: Adobe Community : Unanswered Discussions - After Effects
Viewing all articles
Browse latest Browse all 30854

Initialising Structs vs AEFX_CLR_STRUCT()

$
0
0

Just out of curiosity I decided to initialise a struct with empty curly braces, e.g. PF_ParamDef my_param = {};

 

When debugging it was confirmed that by doing this it initialised everything in the struct to zero (the memory used by the struct was fully zeroed). Surely this is a faster way of clearing a struct than with the macro AEFX_CLR_STRUCT(), right? AEFX_CLR_STRUCT does this explicitly using a while loop to set every byte in the struct to zero, so the end result is valid.

 

IMO this is a much nicer way of declaring struct variables, since you also get to initialise it immediately, which is considered good practice.

 

Christian


Viewing all articles
Browse latest Browse all 30854

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>