c++ - Warning Anonymous namespace inside struct using function pointer -
In my program:
// Place this code in a separate header file. Structure _S1; Typedef Structure {int unused;} * RETVAL; TypeFF REV (* MyFunc) (Zero * result, zero * CTX, straightp1 = S); Typedef Structure _S1 {struct _S1 * Parents; MyFunc f1; } S1; // In the CPP file, include the above header file I get the following warning:
WARNING: A ???? _s1a ???? Is a field ???? _ S1 :: F1A, which uses anonymous namespace [enabled by default] typedef struct _S1 {^ What does this warning mean? What is the result of this warning in my code? How to get rid of this warning?
I am compiling Linux on GCC.
The fact is that you had put your definitions in one header, strongly suggest that you Use multiple headers to use that header, and use those types.
But if there are headers in many source files, they get their own version of RETVAL due to the anonymous structure you are using, even though It is not possible to have the same type in all the source files in the _S1 time. Traditional compilers do not care about this: they do not optimize the full-program. More modern compilers do, and they should be able to tell that the definitions of two types are actually the same type. To be able to tell them, your code should be very accurate.
The easiest solution is to give your anonymous structure a name. A named strip is the same type in all source files, and is such an indicator for designated structures.
Comments
Post a Comment