godotengine / godotengine/godot
@export_flags integer size concerns
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
- Reproducible in 4.2.1
### System information
Godot v4.2.1.stable - macOS 14.3.1 - Vulkan (Forward+) - integrated Apple M2 Max - Apple M2 Max (12 Threads)
### Issue description
I have a question about the `@export_flags` bit fields (which are under the hood integers), and not sure if it is a bug or not. The documentation of `@export_flags` states that:
> Note: A flag value must be at least 1 and at most 2 ** 32 - 1.
And also if you try in the engine to give more than 32 arguments to `@export_flags` it will raise the parse error below:
```
Parse Error: Invalid argument 33 of annotation "@export_flags": Starting from argument 33, the flag value must be specified explicitly.
```
So both the documentation and the error message sound like the bit fields can only hold 32 bits of information. However, I also read that in documentation it also says the `int` type has a size of 64 bits or 8B. I also performed some tests on a `int` variable that has `@export_flags` annotation, it shows that an `@export_flags` field can indeed store 64 bits information.
I am not sure what makes `@export_flags` 32 bits. Is it a bug, a legacy issue, or an intended behavior (for example some compatibility strategy in regard to 32-bit architectures/OS)?
Thank you for your clarification!
### Steps to reproduce
N/A
### Minimal reproduction project (MRP)
N/A
Contributor guide
Research direction
Review the @export_flags documentation alongside the integer type documentation and the reported parse error in Godot v4.2.1. Reproduce the 33-argument case and the 64-bit storage test, then determine whether the documented limit and error are intentional. Done means a clear decision and aligned documentation or error behavior.
Written by the indexing model from the issue text.
Assessment
- Domain
- documentation, game-dev
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100