The declaration qboolean SNDDMA_InitDirect (void); appears in 'WinQuake/snd_win.c' on line 69. However, the function's definition (appearing on line 183 of the same file is written as:
sndinitstat SNDDMA_InitDirect (void) { /* Actual implementation is unimportant in this discussion. */ } Both qboolean, and sndinitstat are typedefs of enumerations: sndinitstat on line 33 of 'WinQuake/snd_win.c',
typedef enum {SIS_SUCCESS, SIS_FAILURE, SIS_NOTAVAIL} sndinitstat; and qboolean in 'WinQuake/common.h' (line 30)
typedef enum {false, true} qboolean; These are different enumerations.
I have been compiling this source with both Visual Studio 2015's built in compiler -- cl.exe -- and Clang v3.7.1 via the LLVM plugin for Visual Studio. Clang states that this difference in declaration/definition is an error. Visual Studio compiles this okay. Who is correct?
Now, to quote C: A Reference Manual (Fourth Edition):
Section 5.5 Enumerated Types (page 127)
The enumeration constants are specified when the type is defined and have the type
int.Section 5.10 Typedef Names (page 149)
Declarations with the
typedefstorage specifier do not introduce new types; the names are considered synonymous for types that could be specified in other ways.
These two paragraphs read to me as if Clang's error is, while helpful, incorrect according to the standard. But I know Microsoft don't have the greatest reputation with correctly compiling C.
typedefs for the same list of enumerations? Or to put it another way, you should add the definitions ofqbooleanandsndinitstatto the question.typedef enum {SIS_SUCCESS, SIS_FAILURE, SIS_NOTAVAIL} sndinitstat;in the link. Do you have access to the typedef forqboolean? It is referenced in the link, but its definition is probably in one of the header files.int. So the typedefs are equivalent totypedef int qbooleanandtypedef int sndinitstat. Hence, Visual Studio thinksqbooleanandsndinitstatare the same type. Common sense (and clang) says that's spectacularly wrong. How a language lawyer would would interpret the spec is debatable, but somewhat pointless. If the correct interpretation of the spec says that Visual Studio is correct, then that just means that the spec is spectacularly wrong.