News for hackers. Stuff that matters.
Re:Flattening ASTs (and Other Compiler Data Structures) by glandium on Sunday July 02, 2023 @07:40AM (#36560483)
It also means you can't share files between little endians and big endians.
Re:Flattening ASTs (and Other Compiler Data Structures) by WJW on Sunday July 02, 2023 @07:56AM (#36560605)
Is this a real problem though? It seems to me that any system you would realistically want to run Blender on will be little-endian.
Re:Flattening ASTs (and Other Compiler Data Structures) by tjalfi on Sunday July 02, 2023 @03:47PM (#36564969)
It isn't a real problem. Blender supports only little-endian targets and the code byte swaps data files as needed. I guess someone could port it to AIX, z/OS, or Linux/zSeries, but that's unlikely at best.
Re:Flattening ASTs (and Other Compiler Data Structures) by rollcat on Sunday July 02, 2023 @08:05AM (#36560674)
There's almost certainly byte order+version markers in the header, a "happy path" that just memcpy's the structs, and a "safe path" that does byte order swapping, migrates the old structs to the current format, etc.

You can version the structs/loaders by keeping the relevant header files in their own version subfolders, and copious usage of sed. I've done this in a Django project to maintain support for ancient untouchable clients using an old version of the API, it's pretty manageable.

Re:Flattening ASTs (and Other Compiler Data Structures) by tjalfi on Sunday July 02, 2023 @04:08PM (#36565150)
I checked the repo. Blender detects files with a different endian and byte swaps if necessary.
Re:Flattening ASTs (and Other Compiler Data Structures) by TazeTSchnitzel on Monday July 03, 2023 @07:07AM (#36571293)
It doesn't, you just need to be careful to always read and write properties via accessor functions.