For Programmers: Free Programming Magazines  


Home > Archive > Visual Studio > February 2005 > Passing a CRITICAL_SECTION Object to a Function









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Passing a CRITICAL_SECTION Object to a Function
Artist

2005-02-09, 3:59 am

The relevent snippets of code are pasted below. The compiler gives this
warning:

warning C4133: 'function' : incompatible types - from 'CRITICAL_SECTION
*__w64 ' to 'CRITICAL_SECTION *'

Why are these incompatible and how did __w64 get involved in this?

*** Code ***

void WritePacketUpdate(struct CRITICAL_SECTION *CritSec); // Prototype

struct TFimState
{ CRITICAL_SECTION CritSecCalc;
};

struct TFimState *f;
struct TFimState FimState[FimState_N];
f = FimState;

WritePacketUpdate( &f->CritSecCalc ); // Warning this line


Alexander Grigoriev

2005-02-14, 4:01 am

Drop 'struct' from the function prototype.

CRITICAL_SECTION is a typedef.

"Artist" <artist@sj.speakeasy.net> wrote in message
news:DOOdnTHZL89LCJTfRVn-3w@speakeasy.net...
> The relevent snippets of code are pasted below. The compiler gives this
> warning:
>
> warning C4133: 'function' : incompatible types - from 'CRITICAL_SECTION
> *__w64 ' to 'CRITICAL_SECTION *'
>
> Why are these incompatible and how did __w64 get involved in this?
>
> *** Code ***
>
> void WritePacketUpdate(struct CRITICAL_SECTION *CritSec); // Prototype
>
> struct TFimState
> { CRITICAL_SECTION CritSecCalc;
> };
>
> struct TFimState *f;
> struct TFimState FimState[FimState_N];
> f = FimState;
>
> WritePacketUpdate( &f->CritSecCalc ); // Warning this line
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com