We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
As in C/C++, enum can has same values
typedef enum { SimdWarpAffineDefault = 0, /*!< Default Warp Affine flags. */ SimdWarpAffineChannelByte = 0, /*!< 8-bit integer channel type. */ SimdWarpAffineChannelMask = 1, /*!< Bit mask of channel type. */ SimdWarpAffineInterpNearest = 0, /*!< Nearest pixel interpolation method. */ SimdWarpAffineInterpBilinear = 2, /*!< Bilinear pixel interpolation method. */ SimdWarpAffineInterpMask = 2, /*!< Bit mask of pixel interpolation options. */ SimdWarpAffineBorderConstant = 0, /*!< Nearest pixel interpolation method. */ SimdWarpAffineBorderTransparent = 4, /*!< Bilinear pixel interpolation method. */ SimdWarpAffineBorderMask = 4, /*!< Bit mask of pixel interpolation options. */ } SimdWarpAffineFlags;
But in v, this will cause compile error:
module main enum SimdWarpAffineFlags { simd_warp_affine_default = 0 simd_warp_affine_channel_byte = 0 simd_warp_affine_channel_mask = 1 simd_warp_affine_interp_nearest = 0 simd_warp_affine_interp_bilinear = 2 simd_warp_affine_interp_mask = 2 simd_warp_affine_border_constant = 0 simd_warp_affine_border_transparent = 4 simd_warp_affine_border_mask = 4 } fn main() { }
test.v:5:40: error: enum value `0` already exists 3 | enum SimdWarpAffineFlags { 4 | simd_warp_affine_default = 0 5 | simd_warp_affine_channel_byte = 0 | ^ 6 | simd_warp_affine_channel_mask = 1 7 | simd_warp_affine_interp_nearest = 0 test.v:7:40: error: enum value `0` already exists 5 | simd_warp_affine_channel_byte = 0 6 | simd_warp_affine_channel_mask = 1 7 | simd_warp_affine_interp_nearest = 0 | ^ 8 | simd_warp_affine_interp_bilinear = 2 9 | simd_warp_affine_interp_mask = 2 test.v:9:40: error: enum value `2` already exists 7 | simd_warp_affine_interp_nearest = 0 8 | simd_warp_affine_interp_bilinear = 2 9 | simd_warp_affine_interp_mask = 2 | ^ 10 | simd_warp_affine_border_constant = 0 11 | simd_warp_affine_border_transparent = 4 test.v:10:40: error: enum value `0` already exists 8 | simd_warp_affine_interp_bilinear = 2 9 | simd_warp_affine_interp_mask = 2 10 | simd_warp_affine_border_constant = 0 | ^ 11 | simd_warp_affine_border_transparent = 4 12 | simd_warp_affine_border_mask = 4 test.v:12:40: error: enum value `4` already exists 10 | simd_warp_affine_border_constant = 0 11 | simd_warp_affine_border_transparent = 4 12 | simd_warp_affine_border_mask = 4 | ^ 13 | } 14 |
I think v can also support same values in enum.
When rewrite some C/C++ code, it need the same enum values.
Fix cgen/checker?
No response
V full version: V 0.4.7 6e8124f.62ab1be
V full version: V 0.4.7 6e8124f.62ab1be OS: linux, Ubuntu 24.04.1 LTS Processor: 8 cpus, 64bit, little endian, Intel(R) Core(TM) i7-9700 CPU @ 3.00GHz
getwd: /media/HD/github/algo/Simd/src/Simd vexe: /media/HD/github/lang/v/v vexe mtime: 2024-09-11 14:36:36
vroot: OK, value: /media/HD/github/lang/v VMODULES: OK, value: /home/mars/.vmodules VTMP: OK, value: /tmp/v_1000
Git version: git version 2.43.0 Git vroot status: weekly.2024.36-47-ge0422de8 (16 commit(s) behind V master) .git/config present: true
CC version: cc (Ubuntu 13.2.0-23ubuntu4) 13.2.0 thirdparty/tcc status: thirdparty-linux-amd64 0134e9b9
Note
You can use the 👍 reaction to increase the issue's priority for developers.
Please note that only the 👍 reaction to the issue itself counts as a vote. Other reactions and those to comments will not be taken into account.
The text was updated successfully, but these errors were encountered:
Use @[_allow_multiple_values] to tag the enum.
@[_allow_multiple_values]
Sorry, something went wrong.
This attribute isn't documented and a hint must be given when this error occurs.
Delta456
Successfully merging a pull request may close this issue.
Describe the feature
As in C/C++, enum can has same values
But in v, this will cause compile error:
I think v can also support same values in enum.
Use Case
When rewrite some C/C++ code, it need the same enum values.
Proposed Solution
Fix cgen/checker?
Other Information
No response
Acknowledgements
Version used
V full version: V 0.4.7 6e8124f.62ab1be
Environment details (OS name and version, etc.)
V full version: V 0.4.7 6e8124f.62ab1be
OS: linux, Ubuntu 24.04.1 LTS
Processor: 8 cpus, 64bit, little endian, Intel(R) Core(TM) i7-9700 CPU @ 3.00GHz
getwd: /media/HD/github/algo/Simd/src/Simd
vexe: /media/HD/github/lang/v/v
vexe mtime: 2024-09-11 14:36:36
vroot: OK, value: /media/HD/github/lang/v
VMODULES: OK, value: /home/mars/.vmodules
VTMP: OK, value: /tmp/v_1000
Git version: git version 2.43.0
Git vroot status: weekly.2024.36-47-ge0422de8 (16 commit(s) behind V master)
.git/config present: true
CC version: cc (Ubuntu 13.2.0-23ubuntu4) 13.2.0
thirdparty/tcc status: thirdparty-linux-amd64 0134e9b9
Note
You can use the 👍 reaction to increase the issue's priority for developers.
Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.
The text was updated successfully, but these errors were encountered: