nurxb01@gmail.com wrote:[color=blue]
> Hi
> I have a very basic doubt.
> The application i'm working on has some old code already in place.
> There are some struct data type decleared in a .h file and are being
> used for RPC communication.
> Further in the application code at some places forward declearion
> for these datatypes are given as class .
> The code compiles without any errors and warning on solaris (g++)and
> linux (g++)but give Compiler Warning C4099 on windows (MSDEV VC6.0) but
> get compiled without any erros.
> ---------Description of warning C4099 starts ( from
> msdn)-----------------------------
> Compiler Warning (level 2) C4099
> 'identifier' : type name first seen using 'objecttype1' now seen using
> 'objecttype2'
>
> The specified object was declared as either a structure or a class but
> was defined as a class or a structure, respectively.
> -----------------------------Description ends
> ------------------------------------
>
> I never observe any problem in the execution of the program on ( Win2k
> , solraris 2.7, RH Linux 7.1 ).
>
> But can the above mentioned code be cause any problem or it's
> perfactly ok to use that code.
>
> //To make it more clear below is the two example header files
> //from file a.h
> //
> struct CompositePt
> {
> double Pt;
> bool mode;
> };
> typedef struct CompositePt CompositePt;
>
> //from file b.h
> //
> class CompositePt;
>
> class SomeApp_Code {
>
> int test_function(CompositePt& point );
> };
>
> Thanks in advance for help[/color]
It is legal forward-declare something as a class and then define it as
a struct (
http://www.gotw.ca/publications/mill04.htm).
Cheers! --M