godot icon indicating copy to clipboard operation
godot copied to clipboard

GDScriptVM: Avoid c-style cast/const_cast

Open rune-scape opened this issue 1 year ago • 2 comments
trafficstars

+replaced c-style casts with more verbose and searchable c++ casts +moved common const_cast of instruction_args to const Variant ** into a ref var

rune-scape avatar Jul 29 '24 00:07 rune-scape

What is the benefit for this code style change?

Edited: it's not very long so it's probably ok and localized to gdscript

fire avatar Jul 29 '24 00:07 fire

im searching for const_casts after https://github.com/godotengine/godot/issues/93759, and trying to find ways to remove them or improve them, this is just a style change. bc of how Vector and CowData might(?) copy the data if stack.ptrw() was used. i didn't want to touch that

the style guide doesnt say anything about casts, but im assuming moving away from c-style casts toward verbose casts is desired

rune-scape avatar Jul 29 '24 01:07 rune-scape