[gmpi] Re: Plugin Factory Update

On Wed, Mar 02, 2005 at 04:18:38PM -0500, Ron Kuper wrote:
> The macro in question winds up being this code:
> 
> // Function call returns nonzero on errors
> if (result = FunctionCall())
> {
> ...
> } 

And that can't be fixed up into
        if ((result = FunctionCall()) == true)
or even 
        if ((result = FunctionCall()))

?

Both forms should defeat any compiler warning.


> -----Original Message-----
> From: gmpi-bounce@xxxxxxxxxxxxx [mailto:gmpi-bounce@xxxxxxxxxxxxx] On
> Behalf Of Paul Davis
> Sent: Wednesday, March 02, 2005 1:43 PM
> To: gmpi@xxxxxxxxxxxxx
> Subject: [gmpi] Re: Plugin Factory Update
> 
> >We compile with maximum warnings and treat warnings as errors.
> However,
> >we have this particular warning #pragmad to be off, because we have
> some
> >very useful runtime error checking macros that actually do assign
> within
> >a conditional. 
> 
> i am sure you know this ron, but the test is for assignment *as* the
> conditional, not within. so,
> 
>            if (a = b)        <= warning
>            if ((a = b) != 0) <= no warning
> 
> i might be dumb, but i can't see how the first example should ever be
> considered good code. the lower example is fine. what devious trick
> have i missed out after all these years? :)
> 
> --p
> 
> ----------------------------------------------------------------------
> Generalized Music Plugin Interface (GMPI) public discussion list
> Participation in this list is contingent upon your abiding by the
> following rules:  Please stay on topic.  You are responsible for your
> own
> words.  Please respect your fellow subscribers.  Please do not
> redistribute anyone else's words without their permission.
> 
> Archive: http://www.freelists.org/archives/gmpi
> Email gmpi-request@xxxxxxxxxxxxx w/ subject "unsubscribe" to unsubscribe
> 
> 
> ----------------------------------------------------------------------
> Generalized Music Plugin Interface (GMPI) public discussion list
> Participation in this list is contingent upon your abiding by the
> following rules:  Please stay on topic.  You are responsible for your own
> words.  Please respect your fellow subscribers.  Please do not
> redistribute anyone else's words without their permission.
> 
> Archive: http://www.freelists.org/archives/gmpi
> Email gmpi-request@xxxxxxxxxxxxx w/ subject "unsubscribe" to unsubscribe
> 

----------------------------------------------------------------------
Generalized Music Plugin Interface (GMPI) public discussion list
Participation in this list is contingent upon your abiding by the
following rules:  Please stay on topic.  You are responsible for your own
words.  Please respect your fellow subscribers.  Please do not
redistribute anyone else's words without their permission.

Archive: http://www.freelists.org/archives/gmpi
Email gmpi-request@xxxxxxxxxxxxx w/ subject "unsubscribe" to unsubscribe

Other related posts: