Thread: Can someone explain this code?

Can someone explain this code?

From
Magnus Hagander
Date:
int
pg_fe_sendauth(AuthRequest areq, PGconn *conn, const char *hostname,           const char *password, char *PQerrormsg)
{
#ifndef KRB5(void) hostname;            /* not used */
#endif

...

(fe-auth.c)

What does that code actually *do*?

//Magnus


Re: Can someone explain this code?

From
Stephen Frost
Date:
* Magnus Hagander (magnus@hagander.net) wrote:
> #ifndef KRB5
>     (void) hostname;            /* not used */
> #endif
[...]
> What does that code actually *do*?

Stop the compiler from complaining about an unused argument.
Thanks,
    Stephen

Re: Can someone explain this code?

From
"Marko Kreen"
Date:
On 7/19/07, Magnus Hagander <magnus@hagander.net> wrote:
> int
> pg_fe_sendauth(AuthRequest areq, PGconn *conn, const char *hostname,
>                            const char *password, char *PQerrormsg)
> {
> #ifndef KRB5
>         (void) hostname;                        /* not used */
> #endif
>
> ...
>
> (fe-auth.c)
>
> What does that code actually *do*?

Somebody tried to work around "unused argument" warning?

-- 
marko


Re: Can someone explain this code?

From
Magnus Hagander
Date:
On Thu, Jul 19, 2007 at 06:41:17AM -0400, Stephen Frost wrote:
> * Magnus Hagander (magnus@hagander.net) wrote:
> > #ifndef KRB5
> >     (void) hostname;            /* not used */
> > #endif
> [...]
> > What does that code actually *do*?
> 
> Stop the compiler from complaining about an unused argument.

That makes sense, except my compiled didn't warn even when I took it out
:-) Ah, well, thanks for clearifying.

//Magnus


Re: Can someone explain this code?

From
Stephen Frost
Date:
* Magnus Hagander (magnus@hagander.net) wrote:
> On Thu, Jul 19, 2007 at 06:41:17AM -0400, Stephen Frost wrote:
> > Stop the compiler from complaining about an unused argument.
>
> That makes sense, except my compiled didn't warn even when I took it out
> :-) Ah, well, thanks for clearifying.

It depends on the compiler you're using..  My recollection is that
it shows up at least w/ gcc and -Wall and/or -pedantic.
Thanks,
    Stephen