Hi all, I wanted to discuss a thing about DNA that I really don't like: DNA structs are always placed in headers that we allow to access globally within the source code. Considering how programming techniques have evolved, that's definitely a bad design for safe programming and no good practice (no blaming here, DNA is from the 90's after all! ;) ). So what I'd like to have is some way to declare structs that DNA can parse but have a more limited scope. One way to do this would be doing something similar to what we do for DNA_DEPRECATED, where usage of struct members causes a compiler warning if DNA_DEPRECATED_ALLOW wasn't defined in the file. However, it would be a bit ugly to have such macros everywhere within structs and it only works for GCC. I tried a nicer way to do this in the workspaces branch, simply by adding a local header (in this case workspace_dna.h) and doing a relative include in makesdna.c. This seems to work just fine, and it's not so ugly even. For reference, check the changes in workspace_dna.h and makesdna.c: https://developer.blender.org/rBbdc209faa9fd172. My question is if that's an acceptable solution or if somebody knows an even better one. Well... or if we even prefer to have public access for DNA structs everywhere ;)
Cheers, - Julian - _______________________________________________ Bf-committers mailing list [email protected] https://lists.blender.org/mailman/listinfo/bf-committers
