cl x64: unsigned long outside / inside union: error C2099: initializer is not a constant / NO error
问题 Case 1. File: test1.c : unsigned long val = (unsigned long)&"test"; int main() { return 0; } Compiler invocation: cl test1.c /c Results: Microsoft (R) C/C++ Optimizing Compiler Version 19.25.28611 for x64 Copyright (C) Microsoft Corporation. All rights reserved. test1.c test1.c(1): warning C4311: 'type cast': pointer truncation from 'char (*)[5]' to 'unsigned long' test1.c(1): error C2099: initializer is not a constant Case 2. File: test2.c : union { unsigned long val; } val = { (unsigned